home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 …ember: Reference Library / Dev.CD Dec 94.toast / Technical Documentation / Mac Tech Notes (DocViewer) / DV • Devices / DV23 Driver Education < prev    next >
MacBinary  |  1994-10-19  |  149.8 KB  |  [ONLN/HLX2]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
100% file MacBinary II, inited, Fri Sep 30 11:27:29 1994, modified Wed Oct 19 10:48:33 1994, creator 'HLX2', type 'ONLN', 149394 bytes "DV23 Driver Education" , at 0x24812 3590 bytes resource default (weak)
99% file data default
100% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[ONLN]
macFileCreator[HLX2]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 15 44 56 32 33 20 44 | 72 69 76 65 72 20 45 64 |..DV23 D|river Ed|
|00000010| 75 63 61 74 69 6f 6e 00 | 00 00 00 00 00 00 00 00 |ucation.|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 02 47 92 00 | 00 0e 06 aa b1 de e1 aa |.....G..|........|
|00000060| ca e2 41 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..A.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 f6 38 00 00 |........|.....8..|
|00000080| 44 56 20 32 33 20 2d 20 | 44 72 69 76 65 72 20 45 |DV 23 - |Driver E|
|00000090| 64 75 63 61 74 69 6f 6e | 0d 44 65 76 69 63 65 73 |ducation|.Devices|
|000000a0| 09 0d 52 65 76 69 73 65 | 64 20 62 79 20 09 43 72 |..Revise|d by .Cr|
|000000b0| 61 69 67 20 50 72 6f 75 | 73 65 20 61 6e 64 20 42 |aig Prou|se and B|
|000000c0| 72 69 61 6e 20 42 65 63 | 68 74 65 6c 09 4d 61 79 |rian Bec|htel.May|
|000000d0| 20 31 39 39 33 0d 57 72 | 69 74 74 65 6e 20 62 79 | 1993.Wr|itten by|
|000000e0| 3a 09 4d 61 72 6b 20 42 | 65 6e 6e 65 74 74 09 41 |:.Mark B|ennett.A|
|000000f0| 75 67 75 73 74 20 31 39 | 39 30 0d 54 68 69 73 20 |ugust 19|90.This |
|00000100| 54 65 63 68 6e 69 63 61 | 6c 20 4e 6f 74 65 20 64 |Technica|l Note d|
|00000110| 65 73 63 72 69 62 65 73 | 20 69 6e 20 64 65 74 61 |escribes| in deta|
|00000120| 69 6c 20 74 68 65 20 6f | 70 65 72 61 74 69 6f 6e |il the o|peration|
|00000130| 20 6f 66 20 74 68 65 20 | 44 65 76 69 63 65 20 4d | of the |Device M|
|00000140| 61 6e 61 67 65 72 20 61 | 6e 64 20 69 74 73 20 69 |anager a|nd its i|
|00000150| 6e 74 65 72 61 63 74 69 | 6f 6e 20 77 69 74 68 20 |nteracti|on with |
|00000160| 64 65 76 69 63 65 20 64 | 72 69 76 65 72 73 2e 20 |device d|rivers. |
|00000170| 49 74 20 70 72 6f 76 69 | 64 65 73 20 74 68 65 20 |It provi|des the |
|00000180| 62 61 63 6b 67 72 6f 75 | 6e 64 20 6e 65 65 64 65 |backgrou|nd neede|
|00000190| 64 20 66 6f 72 20 63 6f | 72 72 65 63 74 20 6f 70 |d for co|rrect op|
|000001a0| 65 72 61 74 69 6f 6e 20 | 6f 66 20 74 68 69 72 64 |eration |of third|
|000001b0| 2d 70 61 72 74 79 20 64 | 65 76 69 63 65 20 64 72 |-party d|evice dr|
|000001c0| 69 76 65 72 73 20 61 6e | 64 20 61 6c 73 6f 20 70 |ivers an|d also p|
|000001d0| 72 65 73 65 6e 74 73 20 | 61 20 6d 65 74 68 6f 64 |resents |a method|
|000001e0| 20 66 6f 72 20 66 69 6e | 64 69 6e 67 20 61 6e 20 | for fin|ding an |
|000001f0| 65 6e 74 72 79 20 69 6e | 20 74 68 65 20 55 6e 69 |entry in| the Uni|
|00000200| 74 20 54 61 62 6c 65 20 | 66 6f 72 20 61 20 64 72 |t Table |for a dr|
|00000210| 69 76 65 72 2e 0d 4d 61 | 6e 79 20 61 73 70 65 63 |iver..Ma|ny aspec|
|00000220| 74 73 20 6f 66 20 74 68 | 65 20 44 65 76 69 63 65 |ts of th|e Device|
|00000230| 20 4d 61 6e 61 67 65 72 | 20 72 65 6d 61 69 6e 20 | Manager| remain |
|00000240| 6d 79 73 74 65 20 62 79 | 20 46 69 6e 64 20 53 74 |myste by| Find St|
|00000250| 79 6c 65 6f 66 20 4d 61 | 63 69 6e 74 6f 73 68 20 |yleof Ma|cintosh |
|00000260| 64 65 76 65 6c 6f 70 65 | 72 73 2c 20 65 73 70 65 |develope|rs, espe|
|00000270| 63 69 61 6c 6c 79 20 74 | 68 6f 73 65 20 77 68 6f |cially t|hose who|
|00000280| 20 6d 69 67 68 74 20 77 | 69 73 68 20 74 6f 20 61 | might w|ish to a|
|00000290| 63 63 6f 6d 70 6c 69 73 | 68 20 74 61 73 6b 73 20 |ccomplis|h tasks |
|000002a0| 6e 6f 74 20 64 69 72 65 | 63 74 6c 79 20 73 75 70 |not dire|ctly sup|
|000002b0| 70 6f 72 74 65 64 20 62 | 79 20 74 68 65 20 63 75 |ported b|y the cu|
|000002c0| 72 72 65 6e 74 20 6f 66 | 66 65 72 69 6e 67 20 6f |rrent of|fering o|
|000002d0| 66 20 63 61 6c 6c 73 2e | 20 46 6f 72 20 65 78 61 |f calls.| For exa|
|000002e0| 6d 70 6c 65 2c 20 64 65 | 76 65 6c 6f 70 65 72 73 |mple, de|velopers|
|000002f0| 20 6d 69 67 68 74 20 77 | 69 73 68 20 74 6f 20 69 | might w|ish to i|
|00000300| 6e 73 74 61 6c 6c 20 74 | 68 65 69 72 20 6f 77 6e |nstall t|heir own|
|00000310| 20 64 72 69 76 65 72 20 | 61 74 20 49 4e 49 54 20 | driver |at INIT |
|00000320| 74 69 6d 65 20 6f 72 20 | 77 69 73 68 20 74 6f 20 |time or |wish to |
|00000330| 6d 61 6e 61 67 65 20 74 | 68 65 69 72 20 6f 77 6e |manage t|heir own|
|00000340| 20 49 2f 4f 20 71 75 65 | 75 65 73 20 66 6f 72 20 | I/O que|ues for |
|00000350| 70 72 6f 63 65 73 73 69 | 6e 67 2e 20 41 20 73 6f |processi|ng. A so|
|00000360| 6c 69 64 20 6b 6e 6f 77 | 6c 65 64 67 65 20 6f 66 |lid know|ledge of|
|00000370| 20 74 68 65 20 44 65 76 | 69 63 65 20 4d 61 6e 61 | the Dev|ice Mana|
|00000380| 67 65 72 20 68 65 6c 70 | 73 20 69 6e 20 74 68 65 |ger help|s in the|
|00000390| 73 65 20 74 61 73 6b 73 | 2c 20 61 73 20 77 65 6c |se tasks|, as wel|
|000003a0| 6c 20 61 73 20 69 6e 20 | 73 69 6d 70 6c 79 20 77 |l as in |simply w|
|000003b0| 72 69 74 69 6e 67 20 61 | 20 6e 6f 72 6d 61 6c 2c |riting a| normal,|
|000003c0| 20 6e 6f 2d 66 72 69 6c | 6c 73 20 64 65 76 69 63 | no-fril|ls devic|
|000003d0| 65 20 64 72 69 76 65 72 | 2e 0d 41 20 67 65 6e 65 |e driver|..A gene|
|000003e0| 72 61 6c 2d 75 73 61 67 | 65 20 64 72 69 76 65 72 |ral-usag|e driver|
|000003f0| 2c 20 77 68 69 63 68 20 | 69 73 20 62 65 73 74 20 |, which |is best |
|00000400| 69 6e 73 74 61 6c 6c 65 | 64 20 61 74 20 49 4e 49 |installe|d at INI|
|00000410| 54 20 74 69 6d 65 2c 20 | 70 72 6f 76 69 64 65 73 |T time, |provides|
|00000420| 20 73 65 72 76 69 63 65 | 73 20 74 6f 20 73 6f 66 | service|s to sof|
|00000430| 74 77 61 72 65 20 74 68 | 61 74 20 6d 69 67 68 74 |tware th|at might|
|00000440| 20 72 75 6e 20 6f 6e 20 | 61 20 4d 61 63 69 6e 74 | run on |a Macint|
|00000450| 6f 73 68 20 61 74 20 61 | 6e 79 20 74 69 6d 65 2e |osh at a|ny time.|
|00000460| 20 54 68 69 73 20 74 79 | 70 65 20 6f 66 20 64 72 | This ty|pe of dr|
|00000470| 69 76 65 72 20 69 73 20 | 74 79 70 69 63 61 6c 6c |iver is |typicall|
|00000480| 79 20 69 6d 70 6c 65 6d | 65 6e 74 65 64 20 62 79 |y implem|ented by|
|00000490| 20 68 61 76 69 6e 67 20 | 61 20 66 69 6c 65 20 6f | having |a file o|
|000004a0| 66 20 74 79 70 65 20 49 | 4e 49 54 2c 20 63 64 65 |f type I|NIT, cde|
|000004b0| 76 2c 20 6f 72 20 52 44 | 45 56 20 74 68 61 74 20 |v, or RD|EV that |
|000004c0| 75 73 65 72 73 20 6d 6f | 76 65 20 69 6e 74 6f 20 |users mo|ve into |
|000004d0| 74 68 65 69 72 20 53 79 | 73 74 65 6d 20 46 6f 6c |their Sy|stem Fol|
|000004e0| 64 65 72 2e 20 54 68 69 | 73 20 66 69 6c 65 20 63 |der. Thi|s file c|
|000004f0| 6f 6e 74 61 69 6e 73 20 | 27 49 4e 49 54 27 20 61 |ontains |'INIT' a|
|00000500| 6e 64 20 27 44 52 56 52 | 27 20 72 65 73 6f 75 72 |nd 'DRVR|' resour|
|00000510| 63 65 73 2c 20 61 6d 6f | 6e 67 20 6f 74 68 65 72 |ces, amo|ng other|
|00000520| 73 2e 20 54 68 65 20 27 | 49 4e 49 54 27 20 72 65 |s. The '|INIT' re|
|00000530| 73 6f 75 72 63 65 20 67 | 65 74 73 20 6c 6f 61 64 |source g|ets load|
|00000540| 65 64 20 69 6e 74 6f 20 | 6d 65 6d 6f 72 79 20 61 |ed into |memory a|
|00000550| 6e 64 20 65 78 65 63 75 | 74 65 64 2c 20 61 74 20 |nd execu|ted, at |
|00000560| 77 68 69 63 68 20 74 69 | 6d 65 20 69 74 20 69 6e |which ti|me it in|
|00000570| 73 74 61 6c 6c 73 20 74 | 68 65 20 64 72 69 76 65 |stalls t|he drive|
|00000580| 72 2e 0d 43 61 76 65 61 | 74 d1 4c 6f 77 20 4d 65 |r..Cavea|t.Low Me|
|00000590| 6d 6f 72 79 20 61 6e 64 | 20 53 79 73 74 65 6d 20 |mory and| System |
|000005a0| 44 61 74 61 20 53 74 72 | 75 63 74 75 72 65 73 0d |Data Str|uctures.|
|000005b0| 57 61 72 6e 69 6e 67 3a | 09 54 68 69 73 20 4e 6f |Warning:|.This No|
|000005c0| 74 65 20 69 6e 76 6f 6c | 76 65 73 20 74 68 65 20 |te invol|ves the |
|000005d0| 64 69 73 63 75 73 73 69 | 6f 6e 20 61 6e 64 20 75 |discussi|on and u|
|000005e0| 73 65 20 6f 66 20 6c 6f | 77 2d 6d 65 6d 6f 72 79 |se of lo|w-memory|
|000005f0| 20 67 6c 6f 62 61 6c 73 | 20 61 6e 64 20 6f 70 65 | globals| and ope|
|00000600| 72 61 74 69 6e 67 20 73 | 79 73 74 65 6d 20 69 6e |rating s|ystem in|
|00000610| 74 65 72 6e 61 6c 20 64 | 61 74 61 20 73 74 72 75 |ternal d|ata stru|
|00000620| 63 74 75 72 65 73 2e 20 | 49 74 20 69 73 20 61 20 |ctures. |It is a |
|00000630| 70 6c 61 69 6e 20 66 61 | 63 74 20 74 68 61 74 20 |plain fa|ct that |
|00000640| 75 73 69 6e 67 20 74 68 | 65 73 65 20 70 75 74 73 |using th|ese puts|
|00000650| 20 73 6f 66 74 77 61 72 | 65 20 61 74 20 61 20 63 | softwar|e at a c|
|00000660| 6f 6d 70 61 74 69 62 69 | 6c 69 74 79 20 72 69 73 |ompatibi|lity ris|
|00000670| 6b 3b 20 74 68 65 72 65 | 66 6f 72 65 2c 20 44 54 |k; there|fore, DT|
|00000680| 53 20 72 65 63 6f 6d 6d | 65 6e 64 73 20 79 6f 75 |S recomm|ends you|
|00000690| 20 61 70 70 72 6f 61 63 | 68 20 74 68 65 20 69 6e | approac|h the in|
|000006a0| 66 6f 72 6d 61 74 69 6f | 6e 20 69 6e 20 74 68 69 |formatio|n in thi|
|000006b0| 73 20 4e 6f 74 65 20 69 | 6e 20 74 68 65 20 66 6f |s Note i|n the fo|
|000006c0| 6c 6c 6f 77 69 6e 67 20 | 6d 61 6e 6e 65 72 3a 0d |llowing |manner:.|
|000006d0| 31 2e 09 49 66 20 79 6f | 75 20 64 6f 20 6e 6f 74 |1..If yo|u do not|
|000006e0| 20 68 61 76 65 20 74 6f | 20 75 73 65 20 61 20 6c | have to| use a l|
|000006f0| 6f 77 2d 6d 65 6d 6f 72 | 79 20 67 6c 6f 62 61 6c |ow-memor|y global|
|00000700| 20 6f 72 20 73 79 73 74 | 65 6d 20 64 61 74 61 20 | or syst|em data |
|00000710| 73 74 72 75 63 74 75 72 | 65 2c 20 74 68 65 6e 20 |structur|e, then |
|00000720| 64 6f 6e d5 74 2e 0d 32 | 2e 09 49 66 20 79 6f 75 |don.t..2|..If you|
|00000730| 20 64 6f 20 68 61 76 65 | 20 74 6f 20 75 73 65 20 | do have| to use |
|00000740| 61 20 6c 6f 77 2d 6d 65 | 6d 6f 72 79 20 67 6c 6f |a low-me|mory glo|
|00000750| 62 61 6c 20 6f 72 20 73 | 79 73 74 65 6d 20 64 61 |bal or s|ystem da|
|00000760| 74 61 20 73 74 72 75 63 | 74 75 72 65 2c 20 75 73 |ta struc|ture, us|
|00000770| 65 20 69 74 20 6f 6e 6c | 79 20 61 73 20 64 65 73 |e it onl|y as des|
|00000780| 63 72 69 62 65 64 20 69 | 6e 20 74 68 69 73 20 4e |cribed i|n this N|
|00000790| 6f 74 65 2c 20 6f 72 20 | 69 6e 20 6f 74 68 65 72 |ote, or |in other|
|000007a0| 2c 20 61 75 74 68 6f 72 | 69 7a 65 64 20 41 70 70 |, author|ized App|
|000007b0| 6c 65 20 43 6f 6d 70 75 | 74 65 72 2c 20 49 6e 63 |le Compu|ter, Inc|
|000007c0| 2e 2c 20 74 65 63 68 6e | 69 63 61 6c 20 64 6f 63 |., techn|ical doc|
|000007d0| 75 6d 65 6e 74 61 74 69 | 6f 6e 2e 0d 33 2e 09 57 |umentati|on..3..W|
|000007e0| 68 65 6e 20 75 73 69 6e | 67 20 61 20 6c 6f 77 2d |hen usin|g a low-|
|000007f0| 6d 65 6d 6f 72 79 20 67 | 6c 6f 62 61 6c 20 6f 72 |memory g|lobal or|
|00000800| 20 73 79 73 74 65 6d 20 | 64 61 74 61 20 73 74 72 | system |data str|
|00000810| 75 63 74 75 72 65 20 69 | 6e 20 61 6e 20 61 75 74 |ucture i|n an aut|
|00000820| 68 6f 72 69 7a 65 64 20 | 6d 61 6e 6e 65 72 2c 20 |horized |manner, |
|00000830| 64 6f 20 73 6f 20 69 6e | 20 61 20 77 61 79 20 74 |do so in| a way t|
|00000840| 68 61 74 20 65 6e 63 61 | 70 73 75 6c 61 74 65 73 |hat enca|psulates|
|00000850| 20 61 6e 64 20 69 73 6f | 6c 61 74 65 73 20 74 68 | and iso|lates th|
|00000860| 69 73 20 64 65 70 65 6e | 64 65 6e 63 79 20 66 72 |is depen|dency fr|
|00000870| 6f 6d 20 74 68 65 20 72 | 65 73 74 20 6f 66 20 74 |om the r|est of t|
|00000880| 68 69 73 20 73 6f 66 74 | 77 61 72 65 2e 20 54 68 |his soft|ware. Th|
|00000890| 69 73 20 77 61 79 2c 20 | 69 66 20 41 70 70 6c 65 |is way, |if Apple|
|000008a0| 20 61 6c 74 65 72 73 20 | 74 68 65 20 73 74 72 75 | alters |the stru|
|000008b0| 63 74 75 72 65 20 6f 66 | 20 73 70 61 63 65 2d 74 |cture of| space-t|
|000008c0| 69 6d 65 20 6f 75 74 20 | 66 72 6f 6d 20 75 6e 64 |ime out |from und|
|000008d0| 65 72 20 79 6f 75 2c 20 | 74 68 65 72 65 20 69 73 |er you, |there is|
|000008e0| 20 6f 6e 65 20 6e 69 63 | 65 2c 20 74 69 64 79 20 | one nic|e, tidy |
|000008f0| 73 70 6f 74 20 74 68 61 | 74 20 79 6f 75 20 68 61 |spot tha|t you ha|
|00000900| 76 65 20 74 6f 20 6d 6f | 64 69 66 79 2e 0d 34 2e |ve to mo|dify..4.|
|00000910| 09 57 68 65 6e 20 41 70 | 70 6c 65 20 70 72 6f 76 |.When Ap|ple prov|
|00000920| 69 64 65 73 20 61 20 73 | 79 73 74 65 6d 2d 69 6e |ides a s|ystem-in|
|00000930| 64 65 70 65 6e 64 65 6e | 74 20 6d 61 6e 6e 65 72 |dependen|t manner|
|00000940| 20 62 79 20 77 68 69 63 | 68 20 79 6f 75 20 63 61 | by whic|h you ca|
|00000950| 6e 20 6f 62 74 61 69 6e | 20 74 68 65 20 73 61 6d |n obtain| the sam|
|00000960| 65 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 2c 20 6d |e inform|ation, m|
|00000970| 6f 64 69 66 79 20 79 6f | 75 72 20 63 6f 64 65 20 |odify yo|ur code |
|00000980| 74 6f 20 75 73 65 20 74 | 68 69 73 20 6d 65 74 68 |to use t|his meth|
|00000990| 6f 64 2e 0d 41 6e 20 65 | 78 61 6d 70 6c 65 20 6f |od..An e|xample o|
|000009a0| 66 20 70 6f 69 6e 74 73 | 20 74 68 72 65 65 20 61 |f points| three a|
|000009b0| 6e 64 20 66 6f 75 72 20 | 77 6f 75 6c 64 20 62 65 |nd four |would be|
|000009c0| 20 75 73 69 6e 67 20 61 | 20 6d 6f 64 75 6c 65 20 | using a| module |
|000009d0| 74 68 61 74 20 72 65 74 | 75 72 6e 73 20 61 20 6c |that ret|urns a l|
|000009e0| 6f 77 2d 6d 65 6d 6f 72 | 79 20 67 6c 6f 62 61 6c |ow-memor|y global|
|000009f0| 20 69 6e 73 74 65 61 64 | 20 6f 66 20 61 6c 77 61 | instead| of alwa|
|00000a00| 79 73 20 72 65 61 63 68 | 69 6e 67 20 69 6e 74 6f |ys reach|ing into|
|00000a10| 20 6c 6f 77 2d 6d 65 6d | 6f 72 79 20 64 69 72 65 | low-mem|ory dire|
|00000a20| 63 74 6c 79 2e 20 46 6f | 72 20 65 78 61 6d 70 6c |ctly. Fo|r exampl|
|00000a30| 65 2c 20 77 68 65 6e 20 | 74 68 69 73 20 4e 6f 74 |e, when |this Not|
|00000a40| 65 20 72 65 66 65 72 65 | 6e 63 65 73 20 74 68 65 |e refere|nces the|
|00000a50| 20 6c 6f 77 2d 6d 65 6d | 6f 72 79 20 67 6c 6f 62 | low-mem|ory glob|
|00000a60| 61 6c 20 55 54 61 62 6c | 65 42 61 73 65 2c 20 74 |al UTabl|eBase, t|
|00000a70| 68 65 20 73 6f 66 74 77 | 61 72 65 20 74 68 61 74 |he softw|are that|
|00000a80| 20 6e 65 65 64 73 20 74 | 68 65 20 76 61 6c 75 65 | needs t|he value|
|00000a90| 20 73 74 6f 72 65 64 20 | 74 68 65 72 65 20 73 68 | stored |there sh|
|00000aa0| 6f 75 6c 64 20 63 61 6c | 6c 20 61 20 72 6f 75 74 |ould cal|l a rout|
|00000ab0| 69 6e 65 20 6c 69 6b 65 | 20 74 68 65 20 66 6f 6c |ine like| the fol|
|00000ac0| 6c 6f 77 69 6e 67 3a 0d | 20 20 20 20 20 20 20 20 |lowing:.| |
|00000ad0| 20 20 20 20 20 20 46 55 | 4e 43 54 49 4f 4e 20 47 | FU|NCTION G|
|00000ae0| 65 74 55 54 61 62 6c 65 | 42 61 73 65 20 3a 20 50 |etUTable|Base : P|
|00000af0| 74 72 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |tr;. | |
|00000b00| 20 20 43 4f 4e 53 54 0d | 20 20 20 20 20 20 20 20 | CONST.| |
|00000b10| 20 20 20 20 20 20 20 20 | 20 20 55 54 61 62 6c 65 | | UTable|
|00000b20| 42 61 73 65 20 3d 20 24 | 31 31 43 3b 0d 20 20 20 |Base = $|11C;. |
|00000b30| 20 20 20 20 20 20 20 20 | 20 20 20 54 59 50 45 0d | | TYPE.|
|00000b40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000b50| 20 20 4c 6f 6e 67 50 74 | 72 20 3d 20 5e 4c 6f 6e | LongPt|r = ^Lon|
|00000b60| 67 49 6e 74 3b 0d 20 20 | 20 20 20 20 20 20 20 20 |gInt;. | |
|00000b70| 20 20 20 20 42 45 47 49 | 4e 0d 20 20 20 20 20 20 | BEGI|N. |
|00000b80| 20 20 20 20 20 20 20 20 | 20 20 20 20 47 65 74 55 | | GetU|
|00000b90| 54 61 62 6c 65 42 61 73 | 65 20 3a 3d 20 50 4f 49 |TableBas|e := POI|
|00000ba0| 4e 54 45 52 28 4c 6f 6e | 67 50 74 72 28 55 54 61 |NTER(Lon|gPtr(UTa|
|00000bb0| 62 6c 65 42 61 73 65 29 | 5e 29 3b 0d 20 20 20 20 |bleBase)|^);. |
|00000bc0| 20 20 20 20 20 20 20 20 | 20 20 45 4e 44 3b 0d 54 | | END;.T|
|00000bd0| 68 65 6e 2c 20 69 66 20 | 41 70 70 6c 65 20 77 65 |hen, if |Apple we|
|00000be0| 72 65 20 74 6f 20 70 72 | 6f 76 69 64 65 20 61 20 |re to pr|ovide a |
|00000bf0| 47 65 73 74 61 6c 74 20 | 63 61 6c 6c 20 74 6f 20 |Gestalt |call to |
|00000c00| 67 65 74 20 74 68 65 20 | 73 61 6d 65 20 76 61 6c |get the |same val|
|00000c10| 75 65 2c 20 6f 6e 6c 79 | 20 74 68 69 73 20 6f 6e |ue, only| this on|
|00000c20| 65 20 6d 6f 64 75 6c 65 | 20 77 6f 75 6c 64 20 28 |e module| would (|
|00000c30| 61 6e 64 20 73 68 6f 75 | 6c 64 29 20 62 65 20 63 |and shou|ld) be c|
|00000c40| 68 61 6e 67 65 64 2e 20 | 49 66 20 79 6f 75 20 61 |hanged. |If you a|
|00000c50| 72 65 20 62 6c 65 73 73 | 65 64 20 65 6e 6f 75 67 |re bless|ed enoug|
|00000c60| 68 20 74 6f 20 62 65 20 | 75 73 69 6e 67 20 61 20 |h to be |using a |
|00000c70| 68 69 67 68 2d 6c 65 76 | 65 6c 20 6f 72 2c 20 62 |high-lev|el or, b|
|00000c80| 65 74 74 65 72 20 79 65 | 74 2c 20 61 6e 20 6f 62 |etter ye|t, an ob|
|00000c90| 6a 65 63 74 2d 6f 72 69 | 65 6e 74 65 64 20 6c 61 |ject-ori|ented la|
|00000ca0| 6e 67 75 61 67 65 2c 20 | 79 6f 75 20 63 61 6e 20 |nguage, |you can |
|00000cb0| 65 76 65 6e 20 66 75 72 | 74 68 65 72 20 69 73 6f |even fur|ther iso|
|00000cc0| 6c 61 74 65 20 74 68 65 | 20 64 65 70 65 6e 64 65 |late the| depende|
|00000cd0| 6e 63 79 20 62 79 20 65 | 6e 63 61 70 73 75 6c 61 |ncy by e|ncapsula|
|00000ce0| 74 69 6e 67 20 61 20 77 | 68 6f 6c 65 20 6d 65 63 |ting a w|hole mec|
|00000cf0| 68 61 6e 69 73 6d 20 74 | 68 61 74 20 72 65 6c 69 |hanism t|hat reli|
|00000d00| 65 73 20 6f 6e 20 6c 6f | 77 2d 6d 65 6d 6f 72 79 |es on lo|w-memory|
|00000d10| 20 67 6c 6f 62 61 6c 73 | 20 61 6e 64 20 73 79 73 | globals| and sys|
|00000d20| 74 65 6d 20 64 61 74 61 | 20 73 74 72 75 63 74 75 |tem data| structu|
|00000d30| 72 65 73 20 69 6e 74 6f | 20 61 20 6d 6f 64 75 6c |res into| a modul|
|00000d40| 65 20 74 68 61 74 20 63 | 61 6e 20 62 65 20 63 6f |e that c|an be co|
|00000d50| 6d 70 6c 65 74 65 6c 79 | 20 72 65 70 6c 61 63 65 |mpletely| replace|
|00000d60| 64 20 69 66 20 6e 65 65 | 64 65 64 2e 0d 49 74 20 |d if nee|ded..It |
|00000d70| 73 68 6f 75 6c 64 20 67 | 6f 20 77 69 74 68 6f 75 |should g|o withou|
|00000d80| 74 20 73 61 79 69 6e 67 | 20 74 68 61 74 20 73 69 |t saying| that si|
|00000d90| 6d 70 6c 79 20 62 65 63 | 61 75 73 65 20 74 68 69 |mply bec|ause thi|
|00000da0| 73 20 4e 6f 74 65 20 75 | 73 65 73 20 73 6f 6d 65 |s Note u|ses some|
|00000db0| 20 6c 6f 77 2d 6d 65 6d | 6f 72 79 20 67 6c 6f 62 | low-mem|ory glob|
|00000dc0| 61 6c 73 20 61 6e 64 20 | 73 79 73 74 65 6d 20 64 |als and |system d|
|00000dd0| 61 74 61 20 73 74 72 75 | 63 74 75 72 65 73 2c 20 |ata stru|ctures, |
|00000de0| 69 74 20 64 6f 65 73 20 | 6e 6f 74 20 6d 65 61 6e |it does |not mean|
|00000df0| 20 41 70 70 6c 65 20 68 | 61 73 20 67 6f 6e 65 20 | Apple h|as gone |
|00000e00| 73 6f 66 74 20 6f 6e 20 | 73 6f 66 74 77 61 72 65 |soft on |software|
|00000e10| 20 74 68 61 74 20 75 73 | 65 73 20 74 68 65 6d 2c | that us|es them,|
|00000e20| 20 65 73 70 65 63 69 61 | 6c 6c 79 20 77 68 65 6e | especia|lly when|
|00000e30| 20 74 68 65 79 20 76 69 | 6f 6c 61 74 65 20 74 68 | they vi|olate th|
|00000e40| 65 20 61 66 6f 72 65 6d | 65 6e 74 69 6f 6e 65 64 |e aforem|entioned|
|00000e50| 20 67 75 69 64 65 6c 69 | 6e 65 73 2e 0d 44 72 69 | guideli|nes..Dri|
|00000e60| 76 65 6e 20 74 6f 20 54 | 65 61 72 73 0d 41 20 73 |ven to T|ears.A s|
|00000e70| 6f 6c 69 64 20 75 6e 64 | 65 72 73 74 61 6e 64 69 |olid und|erstandi|
|00000e80| 6e 67 20 6f 66 20 74 68 | 65 20 44 65 76 69 63 65 |ng of th|e Device|
|00000e90| 20 4d 61 6e 61 67 65 72 | 20 62 65 67 69 6e 73 20 | Manager| begins |
|00000ea0| 77 69 74 68 20 6b 6e 6f | 77 6c 65 64 67 65 20 6f |with kno|wledge o|
|00000eb0| 66 20 69 74 73 20 64 61 | 74 61 20 73 74 72 75 63 |f its da|ta struc|
|00000ec0| 74 75 72 65 73 2e 20 41 | 6c 74 68 6f 75 67 68 20 |tures. A|lthough |
|00000ed0| 6d 75 63 68 20 6f 66 20 | 74 68 65 20 66 6f 6c 6c |much of |the foll|
|00000ee0| 6f 77 69 6e 67 20 69 73 | 20 64 65 73 63 72 69 62 |owing is| describ|
|00000ef0| 65 64 20 69 6e 20 49 6e | 73 69 64 65 20 4d 61 63 |ed in In|side Mac|
|00000f00| 69 6e 74 6f 73 68 2c 20 | 41 70 70 6c 65 20 68 61 |intosh, |Apple ha|
|00000f10| 73 20 6d 61 64 65 20 73 | 6f 6d 65 20 63 68 61 6e |s made s|ome chan|
|00000f20| 67 65 73 20 73 69 6e 63 | 65 20 69 74 73 20 70 75 |ges sinc|e its pu|
|00000f30| 62 6c 69 63 61 74 69 6f | 6e 2e 0d 46 69 72 73 74 |blicatio|n..First|
|00000f40| 2c 20 74 68 65 72 65 20 | 69 73 20 74 68 65 20 73 |, there |is the s|
|00000f50| 74 72 75 63 74 75 72 65 | 20 6f 66 20 74 68 65 20 |tructure| of the |
|00000f60| 75 6e 69 74 20 74 61 62 | 6c 65 2e 20 49 74 20 69 |unit tab|le. It i|
|00000f70| 73 20 61 20 6e 6f 6e 72 | 65 6c 6f 63 61 74 61 62 |s a nonr|elocatab|
|00000f80| 6c 65 20 62 6c 6f 63 6b | 20 69 6e 20 74 68 65 20 |le block| in the |
|00000f90| 73 79 73 74 65 6d 20 68 | 65 61 70 20 74 68 61 74 |system h|eap that|
|00000fa0| 20 69 73 20 70 6f 69 6e | 74 65 64 20 74 6f 20 62 | is poin|ted to b|
|00000fb0| 79 20 74 68 65 20 6c 6f | 77 2d 6d 65 6d 6f 72 79 |y the lo|w-memory|
|00000fc0| 20 67 6c 6f 62 61 6c 20 | 55 54 61 62 6c 65 42 61 | global |UTableBa|
|00000fd0| 73 65 20 28 24 31 31 43 | 29 2e 20 54 68 65 20 75 |se ($11C|). The u|
|00000fe0| 6e 69 74 20 74 61 62 6c | 65 20 69 73 20 61 20 63 |nit tabl|e is a c|
|00000ff0| 6f 6e 74 69 67 75 6f 75 | 73 20 74 61 62 6c 65 20 |ontiguou|s table |
|00001000| 6f 66 20 68 61 6e 64 6c | 65 73 20 74 6f 20 44 65 |of handl|es to De|
|00001010| 76 69 63 65 20 43 6f 6e | 74 72 6f 6c 20 45 6e 74 |vice Con|trol Ent|
|00001020| 72 79 20 28 44 43 45 29 | 20 72 65 63 6f 72 64 73 |ry (DCE)| records|
|00001030| 2e 20 54 68 65 20 6f 66 | 66 73 65 74 20 6f 66 20 |. The of|fset of |
|00001040| 61 20 68 61 6e 64 6c 65 | 20 77 69 74 68 69 6e 20 |a handle| within |
|00001050| 74 68 65 20 75 6e 69 74 | 20 74 61 62 6c 65 20 28 |the unit| table (|
|00001060| 69 74 73 20 65 6e 74 72 | 79 2c 20 6f 72 20 d2 73 |its entr|y, or .s|
|00001070| 6c 6f 74 d3 29 20 64 65 | 74 65 72 6d 69 6e 65 73 |lot.) de|termines|
|00001080| 20 74 68 65 20 75 6e 69 | 74 20 6e 75 6d 62 65 72 | the uni|t number|
|00001090| 20 66 6f 72 20 74 68 65 | 20 64 72 69 76 65 72 2c | for the| driver,|
|000010a0| 20 61 73 20 77 65 6c 6c | 20 61 73 20 74 68 65 20 | as well| as the |
|000010b0| 72 65 66 6e 75 6d 20 66 | 6f 72 20 74 68 61 74 20 |refnum f|or that |
|000010c0| 68 61 6e 64 6c 65 2c 20 | 73 69 6e 63 65 20 61 20 |handle, |since a |
|000010d0| 75 6e 69 74 20 6e 75 6d | 62 65 72 20 72 65 6c 61 |unit num|ber rela|
|000010e0| 74 65 73 20 74 6f 20 61 | 20 72 65 66 6e 75 6d 20 |tes to a| refnum |
|000010f0| 69 6e 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |in the f|ollowing|
|00001100| 20 77 61 79 3a 0d 20 20 | 20 20 72 65 66 6e 75 6d | way:. | refnum|
|00001110| 20 3d 20 7e 28 20 75 6e | 69 74 20 6e 75 6d 62 65 | = ~( un|it numbe|
|00001120| 72 20 29 0d 49 66 20 74 | 68 65 20 68 61 6e 64 6c |r ).If t|he handl|
|00001130| 65 20 61 74 20 61 20 70 | 61 72 74 69 63 75 6c 61 |e at a p|articula|
|00001140| 72 20 73 6c 6f 74 20 69 | 73 20 4e 49 4c 2c 20 74 |r slot i|s NIL, t|
|00001150| 68 65 72 65 20 69 73 20 | 6e 6f 20 44 43 45 20 61 |here is |no DCE a|
|00001160| 6e 64 20 74 68 75 73 20 | 6e 6f 20 64 72 69 76 65 |nd thus |no drive|
|00001170| 72 20 69 6e 73 74 61 6c | 6c 65 64 20 66 6f 72 20 |r instal|led for |
|00001180| 74 68 61 74 20 72 65 66 | 6e 75 6d 2e 20 54 68 65 |that ref|num. The|
|00001190| 72 65 20 69 73 20 61 6e | 6f 74 68 65 72 20 6c 6f |re is an|other lo|
|000011a0| 77 2d 6d 65 6d 6f 72 79 | 20 67 6c 6f 62 61 6c 2c |w-memory| global,|
|000011b0| 20 55 6e 69 74 4e 74 72 | 79 43 6e 74 20 28 24 31 | UnitNtr|yCnt ($1|
|000011c0| 44 32 29 2c 20 77 68 69 | 63 68 20 69 73 20 74 68 |D2), whi|ch is th|
|000011d0| 65 20 63 6f 75 6e 74 20 | 6f 66 20 65 6e 74 72 69 |e count |of entri|
|000011e0| 65 73 20 69 6e 20 74 68 | 65 20 75 6e 69 74 20 74 |es in th|e unit t|
|000011f0| 61 62 6c 65 2e 20 54 68 | 69 73 20 6c 6f 77 2d 6d |able. Th|is low-m|
|00001200| 65 6d 6f 72 79 20 67 6c | 6f 62 61 6c 20 63 61 6e |emory gl|obal can|
|00001210| 20 62 65 20 75 73 65 64 | 20 74 6f 20 6b 6e 6f 77 | be used| to know|
|00001220| 20 77 68 65 6e 20 74 6f | 20 73 74 6f 70 20 73 65 | when to| stop se|
|00001230| 61 72 63 68 69 6e 67 20 | 74 68 65 20 75 6e 69 74 |arching |the unit|
|00001240| 20 74 61 62 6c 65 2e 0d | 4d 61 6e 79 20 6f 66 20 | table..|Many of |
|00001250| 74 68 65 20 73 6c 6f 74 | 73 20 69 6e 20 74 68 65 |the slot|s in the|
|00001260| 20 75 6e 69 74 20 74 61 | 62 6c 65 20 61 72 65 20 | unit ta|ble are |
|00001270| 63 6f 6d 6d 69 74 74 65 | 64 20 74 6f 20 63 65 72 |committe|d to cer|
|00001280| 74 61 69 6e 20 64 65 76 | 69 63 65 73 20 64 75 65 |tain dev|ices due|
|00001290| 20 74 6f 20 74 68 65 20 | 66 61 63 74 20 74 68 61 | to the |fact tha|
|000012a0| 74 20 74 68 65 20 63 6f | 72 72 65 73 70 6f 6e 64 |t the co|rrespond|
|000012b0| 69 6e 67 20 72 65 66 65 | 72 65 6e 63 65 20 6e 75 |ing refe|rence nu|
|000012c0| 6d 62 65 72 73 20 61 72 | 65 20 63 6f 6d 6d 69 74 |mbers ar|e commit|
|000012d0| 74 65 64 20 74 6f 20 74 | 68 6f 73 65 20 64 65 76 |ted to t|hose dev|
|000012e0| 69 63 65 73 2e 20 46 6f | 72 20 65 78 61 6d 70 6c |ices. Fo|r exampl|
|000012f0| 65 2c 20 74 68 65 20 72 | 65 66 6e 75 6d 20 2d 33 |e, the r|efnum -3|
|00001300| 20 69 73 20 72 65 73 65 | 72 76 65 64 20 66 6f 72 | is rese|rved for|
|00001310| 20 74 68 65 20 2e 50 72 | 69 6e 74 20 64 72 69 76 | the .Pr|int driv|
|00001320| 65 72 3b 20 74 68 65 72 | 65 66 6f 72 65 2c 20 75 |er; ther|efore, u|
|00001330| 6e 69 74 20 6e 75 6d 62 | 65 72 20 2d 28 2d 33 29 |nit numb|er -(-3)|
|00001340| 2d 31 3d 32 20 69 73 20 | 72 65 73 65 72 76 65 64 |-1=2 is |reserved|
|00001350| 2c 20 77 68 69 63 68 20 | 6d 65 61 6e 73 20 74 68 |, which |means th|
|00001360| 61 74 20 74 68 65 20 73 | 6c 6f 74 20 61 74 20 6f |at the s|lot at o|
|00001370| 66 66 73 65 74 20 38 20 | 28 34 20 62 79 74 65 73 |ffset 8 |(4 bytes|
|00001380| 20 70 65 72 20 68 61 6e | 64 6c 65 20 2a 20 32 29 | per han|dle * 2)|
|00001390| 20 69 6e 20 74 68 65 20 | 75 6e 69 74 20 74 61 62 | in the |unit tab|
|000013a0| 6c 65 20 69 73 20 72 65 | 73 65 72 76 65 64 20 66 |le is re|served f|
|000013b0| 6f 72 20 74 68 65 20 68 | 61 6e 64 6c 65 20 74 6f |or the h|andle to|
|000013c0| 20 74 68 65 20 44 43 45 | 20 6f 66 20 74 68 65 20 | the DCE| of the |
|000013d0| 2e 50 72 69 6e 74 20 64 | 72 69 76 65 72 2e 20 54 |.Print d|river. T|
|000013e0| 68 69 73 20 72 65 6c 61 | 74 69 6f 6e 73 68 69 70 |his rela|tionship|
|000013f0| 20 69 73 20 74 72 75 65 | 20 65 76 65 6e 20 69 66 | is true| even if|
|00001400| 20 74 68 65 20 73 6c 6f | 74 20 69 73 20 63 75 72 | the slo|t is cur|
|00001410| 72 65 6e 74 6c 79 20 4e | 49 4c 2c 20 62 65 63 61 |rently N|IL, beca|
|00001420| 75 73 65 20 61 20 6c 6f | 74 20 6f 66 20 74 68 65 |use a lo|t of the|
|00001430| 20 6f 70 65 72 61 74 69 | 6e 67 20 73 79 73 74 65 | operati|ng syste|
|00001440| 6d 2c 20 54 6f 6f 6c 62 | 6f 78 2c 20 61 6e 64 20 |m, Toolb|ox, and |
|00001450| 61 70 70 6c 69 63 61 74 | 69 6f 6e 73 20 6d 61 6b |applicat|ions mak|
|00001460| 65 20 68 65 61 76 79 20 | 61 73 73 75 6d 70 74 69 |e heavy |assumpti|
|00001470| 6f 6e 73 20 61 62 6f 75 | 74 20 74 68 65 20 72 65 |ons abou|t the re|
|00001480| 66 6e 75 6d 20 6f 66 20 | 61 20 70 61 72 74 69 63 |fnum of |a partic|
|00001490| 75 6c 61 72 20 64 65 76 | 69 63 65 2e 20 54 68 65 |ular dev|ice. The|
|000014a0| 72 65 20 61 72 65 20 6d | 6f 72 65 20 64 65 74 61 |re are m|ore deta|
|000014b0| 69 6c 65 64 20 6c 69 73 | 74 73 20 69 6e 20 49 6e |iled lis|ts in In|
|000014c0| 73 69 64 65 20 4d 61 63 | 69 6e 74 6f 73 68 2c 20 |side Mac|intosh, |
|000014d0| 62 75 74 20 66 6f 6c 6c | 6f 77 69 6e 67 20 69 73 |but foll|owing is|
|000014e0| 20 61 20 73 75 6d 6d 61 | 72 79 20 6c 69 73 74 20 | a summa|ry list |
|000014f0| 6f 66 20 77 68 61 74 20 | 75 6e 69 74 20 6e 75 6d |of what |unit num|
|00001500| 62 65 72 73 20 61 72 65 | 20 63 6f 6d 6d 69 74 74 |bers are| committ|
|00001510| 65 64 20 74 6f 20 77 68 | 61 74 20 64 65 76 69 63 |ed to wh|at devic|
|00001520| 65 20 74 79 70 65 73 3a | 0d 55 6e 69 74 20 4e 75 |e types:|.Unit Nu|
|00001530| 6d 62 65 72 20 52 61 6e | 67 65 09 52 65 66 6e 75 |mber Ran|ge.Refnu|
|00001540| 6d 20 52 61 6e 67 65 09 | 55 73 61 67 65 0d 30 20 |m Range.|Usage.0 |
|00001550| 74 68 72 6f 75 67 68 20 | 31 31 09 2d 31 20 74 68 |through |11.-1 th|
|00001560| 72 6f 75 67 68 20 2d 31 | 32 09 53 65 72 69 61 6c |rough -1|2.Serial|
|00001570| 2c 20 64 69 73 6b 2c 20 | 41 70 70 6c 65 54 61 6c |, disk, |AppleTal|
|00001580| 6b 2c 20 70 72 69 6e 74 | 65 72 2c 20 09 09 61 6e |k, print|er, ..an|
|00001590| 64 20 73 6f 20 6f 6e 0d | 31 32 20 74 68 72 6f 75 |d so on.|12 throu|
|000015a0| 67 68 20 33 31 09 2d 31 | 33 20 74 68 72 6f 75 67 |gh 31.-1|3 throug|
|000015b0| 68 20 2d 33 32 09 44 65 | 73 6b 20 61 63 63 65 73 |h -32.De|sk acces|
|000015c0| 73 6f 72 69 65 73 0d 33 | 32 20 74 68 72 6f 75 67 |sories.3|2 throug|
|000015d0| 68 20 33 39 09 2d 33 33 | 20 74 68 72 6f 75 67 68 |h 39.-33| through|
|000015e0| 20 2d 34 30 09 53 43 53 | 49 20 64 65 76 69 63 65 | -40.SCS|I device|
|000015f0| 73 0d 34 30 20 74 68 72 | 6f 75 67 68 20 34 37 09 |s.40 thr|ough 47.|
|00001600| 2d 34 31 20 74 68 72 6f | 75 67 68 20 2d 34 38 09 |-41 thro|ugh -48.|
|00001610| 41 70 70 6c 65 53 68 61 | 72 65 20 61 6e 64 20 6f |AppleSha|re and o|
|00001620| 74 68 65 72 20 72 65 73 | 65 72 76 65 64 20 66 6f |ther res|erved fo|
|00001630| 72 20 09 09 41 70 70 6c | 65 0d 34 38 20 74 68 72 |r ..Appl|e.48 thr|
|00001640| 6f 75 67 68 20 36 33 2c | 20 31 32 37 09 2d 34 39 |ough 63,| 127.-49|
|00001650| 20 74 68 72 6f 75 67 68 | 20 2d 36 34 2c 20 2d 31 | through| -64, -1|
|00001660| 32 38 09 53 6c 6f 74 20 | 64 72 69 76 65 72 73 d1 |28.Slot |drivers.|
|00001670| 6f 70 65 6e 20 66 6f 72 | 20 6f 74 68 65 72 20 09 |open for| other .|
|00001680| 09 64 72 69 76 65 72 73 | 20 61 73 20 77 65 6c 6c |.drivers| as well|
|00001690| 0d 54 68 65 20 65 6e 74 | 72 79 20 66 6f 72 20 75 |.The ent|ry for u|
|000016a0| 6e 69 74 20 6e 75 6d 62 | 65 72 73 20 34 38 20 61 |nit numb|ers 48 a|
|000016b0| 6e 64 20 61 62 6f 76 65 | 20 72 65 71 75 69 72 65 |nd above| require|
|000016c0| 73 20 73 6f 6d 65 20 65 | 78 70 6c 61 6e 61 74 69 |s some e|xplanati|
|000016d0| 6f 6e 2e 20 46 69 72 73 | 74 2c 20 6f 6e 20 74 68 |on. Firs|t, on th|
|000016e0| 65 20 4d 61 63 69 6e 74 | 6f 73 68 20 35 31 32 4b |e Macint|osh 512K|
|000016f0| 45 20 61 6e 64 20 4d 61 | 63 69 6e 74 6f 73 68 20 |E and Ma|cintosh |
|00001700| 50 6c 75 73 2c 20 74 68 | 65 20 75 6e 69 74 20 74 |Plus, th|e unit t|
|00001710| 61 62 6c 65 20 64 6f 65 | 73 20 6e 6f 74 20 67 6f |able doe|s not go|
|00001720| 20 70 61 73 74 20 75 6e | 69 74 20 6e 75 6d 62 65 | past un|it numbe|
|00001730| 72 20 34 37 3b 20 74 68 | 69 73 20 70 6f 69 6e 74 |r 47; th|is point|
|00001740| 20 69 73 20 61 64 64 72 | 65 73 73 65 64 20 6c 61 | is addr|essed la|
|00001750| 74 65 72 2e 20 4f 6e 20 | 74 68 65 20 4d 61 63 69 |ter. On |the Maci|
|00001760| 6e 74 6f 73 68 20 53 45 | 2c 20 74 68 65 20 75 6e |ntosh SE|, the un|
|00001770| 69 74 20 74 61 62 6c 65 | 20 69 73 20 6c 61 72 67 |it table| is larg|
|00001780| 65 20 65 6e 6f 75 67 68 | 20 74 6f 20 68 6f 6c 64 |e enough| to hold|
|00001790| 20 75 70 20 74 6f 20 75 | 6e 69 74 20 6e 75 6d 62 | up to u|nit numb|
|000017a0| 65 72 20 36 33 2e 20 4f | 6e 20 74 68 65 20 4d 61 |er 63. O|n the Ma|
|000017b0| 63 69 6e 74 6f 73 68 20 | 49 49 20 66 61 6d 69 6c |cintosh |II famil|
|000017c0| 79 20 6f 66 20 6d 61 63 | 68 69 6e 65 73 2c 20 74 |y of mac|hines, t|
|000017d0| 68 65 20 75 6e 69 74 20 | 74 61 62 6c 65 20 69 73 |he unit |table is|
|000017e0| 20 6c 61 72 67 65 20 65 | 6e 6f 75 67 68 20 74 6f | large e|nough to|
|000017f0| 20 68 6f 6c 64 20 75 70 | 20 74 6f 20 75 6e 69 74 | hold up| to unit|
|00001800| 20 6e 75 6d 62 65 72 20 | 31 32 37 3b 20 55 6e 69 | number |127; Uni|
|00001810| 74 4e 74 72 79 43 6e 74 | 20 69 73 20 70 72 6f 62 |tNtryCnt| is prob|
|00001820| 61 62 6c 79 20 6c 6f 77 | 65 72 2c 20 74 68 6f 75 |ably low|er, thou|
|00001830| 67 68 20 6e 6f 74 20 6c | 6f 77 65 72 20 74 68 61 |gh not l|ower tha|
|00001840| 6e 20 36 34 2e 0d 41 66 | 74 65 72 20 64 6f 63 75 |n 64..Af|ter docu|
|00001850| 6d 65 6e 74 69 6e 67 20 | 74 68 65 20 64 65 76 69 |menting |the devi|
|00001860| 63 65 20 63 6f 6e 74 72 | 6f 6c 20 65 6e 74 72 79 |ce contr|ol entry|
|00001870| 20 62 6c 6f 63 6b 73 20 | 69 6e 20 49 6e 73 69 64 | blocks |in Insid|
|00001880| 65 20 4d 61 63 69 6e 74 | 6f 73 68 2c 20 56 6f 6c |e Macint|osh, Vol|
|00001890| 75 6d 65 20 49 49 2c 20 | 41 70 70 6c 65 20 68 61 |ume II, |Apple ha|
|000018a0| 73 20 65 78 70 61 6e 64 | 65 64 20 74 68 65 6d 20 |s expand|ed them |
|000018b0| 74 6f 20 64 65 61 6c 20 | 77 69 74 68 20 6e 65 77 |to deal |with new|
|000018c0| 20 66 65 61 74 75 72 65 | 73 20 6c 69 6b 65 20 74 | feature|s like t|
|000018d0| 68 65 20 53 6c 6f 74 20 | 4d 61 6e 61 67 65 72 2e |he Slot |Manager.|
|000018e0| 20 54 68 65 20 6e 65 77 | 20 44 43 45 20 6c 6f 6f | The new| DCE loo|
|000018f0| 6b 73 20 74 68 65 20 73 | 61 6d 65 20 61 73 20 74 |ks the s|ame as t|
|00001900| 68 65 20 6f 6c 64 20 44 | 43 45 2c 20 62 75 74 20 |he old D|CE, but |
|00001910| 63 6f 6e 74 61 69 6e 73 | 20 61 20 66 65 77 20 61 |contains| a few a|
|00001920| 64 64 69 74 69 6f 6e 61 | 6c 20 66 69 65 6c 64 73 |dditiona|l fields|
|00001930| 3a 0d 20 20 20 20 54 59 | 50 45 20 41 75 78 44 43 |:. TY|PE AuxDC|
|00001940| 45 20 3d 20 50 41 43 4b | 45 44 20 52 45 43 4f 52 |E = PACK|ED RECOR|
|00001950| 44 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |D. | |
|00001960| 20 20 20 20 20 20 20 64 | 43 74 6c 44 72 69 76 65 | d|CtlDrive|
|00001970| 72 3a 20 20 20 20 50 74 | 72 3b 0d 20 20 20 20 20 |r: Pt|r;. |
|00001980| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001990| 64 43 74 6c 46 6c 61 67 | 73 3a 20 20 20 20 20 49 |dCtlFlag|s: I|
|000019a0| 4e 54 45 47 45 52 3b 0d | 20 20 20 20 20 20 20 20 |NTEGER;.| |
|000019b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 64 43 74 | | dCt|
|000019c0| 6c 51 48 64 72 3a 20 20 | 20 20 20 20 51 48 64 72 |lQHdr: | QHdr|
|000019d0| 3b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;. | |
|000019e0| 20 20 20 20 20 20 20 64 | 43 74 6c 50 6f 73 69 74 | d|CtlPosit|
|000019f0| 69 6f 6e 3a 20 20 4c 4f | 4e 47 49 4e 54 3b 0d 20 |ion: LO|NGINT;. |
|00001a00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a10| 20 20 20 20 64 43 74 6c | 53 74 6f 72 61 67 65 3a | dCtl|Storage:|
|00001a20| 20 20 20 48 61 6e 64 6c | 65 3b 0d 20 20 20 20 20 | Handl|e;. |
|00001a30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a40| 64 43 74 6c 52 65 66 6e | 75 6d 3a 20 20 20 20 49 |dCtlRefn|um: I|
|00001a50| 4e 54 45 47 45 52 3b 0d | 20 20 20 20 20 20 20 20 |NTEGER;.| |
|00001a60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 64 43 74 | | dCt|
|00001a70| 6c 43 75 72 54 69 63 6b | 73 3a 20 20 4c 4f 4e 47 |lCurTick|s: LONG|
|00001a80| 49 4e 54 3b 0d 20 20 20 | 20 20 20 20 20 20 20 20 |INT;. | |
|00001a90| 20 20 20 20 20 20 20 20 | 20 20 64 43 74 6c 57 69 | | dCtlWi|
|00001aa0| 6e 64 6f 77 3a 20 20 20 | 20 50 74 72 3b 0d 20 20 |ndow: | Ptr;. |
|00001ab0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ac0| 20 20 20 64 43 74 6c 44 | 65 6c 61 79 3a 20 20 20 | dCtlD|elay: |
|00001ad0| 20 20 49 4e 54 45 47 45 | 52 3b 0d 20 20 20 20 20 | INTEGE|R;. |
|00001ae0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001af0| 64 43 74 6c 45 4d 61 73 | 6b 3a 20 20 20 20 20 49 |dCtlEMas|k: I|
|00001b00| 4e 54 45 47 45 52 3b 0d | 20 20 20 20 20 20 20 20 |NTEGER;.| |
|00001b10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 64 43 74 | | dCt|
|00001b20| 6c 4d 65 6e 75 3a 20 20 | 20 20 20 20 49 4e 54 45 |lMenu: | INTE|
|00001b30| 47 45 52 3b 0d 54 68 65 | 20 66 6f 6c 6c 6f 77 69 |GER;.The| followi|
|00001b40| 6e 67 20 66 69 65 6c 64 | 73 20 61 72 65 20 74 68 |ng field|s are th|
|00001b50| 65 20 61 64 64 69 74 69 | 6f 6e 73 20 66 6f 72 20 |e additi|ons for |
|00001b60| 74 68 65 20 6e 65 77 20 | 44 43 45 20 72 65 63 6f |the new |DCE reco|
|00001b70| 72 64 3a 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |rd:. | |
|00001b80| 20 20 20 20 20 20 20 20 | 20 64 43 74 6c 53 6c 6f | | dCtlSlo|
|00001b90| 74 3a 20 20 20 20 20 20 | 42 79 74 65 3b 0d 20 20 |t: |Byte;. |
|00001ba0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001bb0| 20 20 20 64 43 74 6c 53 | 6c 6f 74 49 64 3a 20 20 | dCtlS|lotId: |
|00001bc0| 20 20 42 79 74 65 3b 0d | 20 20 20 20 20 20 20 20 | Byte;.| |
|00001bd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 64 43 74 | | dCt|
|00001be0| 6c 44 65 76 42 61 73 65 | 3a 20 20 20 4c 4f 4e 47 |lDevBase|: LONG|
|00001bf0| 49 4e 54 3b 0d 20 20 20 | 20 20 20 20 20 20 20 20 |INT;. | |
|00001c00| 20 20 20 20 20 20 20 20 | 20 20 72 65 73 65 72 76 | | reserv|
|00001c10| 65 64 3a 20 20 20 20 20 | 20 4c 4f 4e 47 49 4e 54 |ed: | LONGINT|
|00001c20| 3b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;. | |
|00001c30| 20 20 20 20 20 20 20 64 | 43 74 6c 45 78 74 44 65 | d|CtlExtDe|
|00001c40| 76 3a 20 20 20 20 42 79 | 74 65 3b 0d 20 20 20 20 |v: By|te;. |
|00001c50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001c60| 20 66 69 6c 6c 42 79 74 | 65 3a 20 20 20 20 20 20 | fillByt|e: |
|00001c70| 42 79 74 65 3b 0d 20 20 | 20 20 20 20 20 20 20 20 |Byte;. | |
|00001c80| 20 20 20 20 20 20 20 20 | 45 4e 44 3b 0d 54 68 65 | |END;.The|
|00001c90| 20 63 6f 72 65 20 73 74 | 72 75 63 74 75 72 65 20 | core st|ructure |
|00001ca0| 6f 66 20 70 61 72 61 6d | 65 74 65 72 20 62 6c 6f |of param|eter blo|
|00001cb0| 63 6b 73 20 68 61 73 20 | 72 65 6d 61 69 6e 65 64 |cks has |remained|
|00001cc0| 20 74 68 65 20 73 61 6d | 65 20 61 73 20 64 65 73 | the sam|e as des|
|00001cd0| 63 72 69 62 65 64 20 69 | 6e 20 49 6e 73 69 64 65 |cribed i|n Inside|
|00001ce0| 20 4d 61 63 69 6e 74 6f | 73 68 2e 20 54 68 65 79 | Macinto|sh. They|
|00001cf0| 20 62 65 67 69 6e 20 77 | 69 74 68 20 74 68 65 20 | begin w|ith the |
|00001d00| 73 74 61 6e 64 61 72 64 | 20 49 2f 4f 20 71 75 65 |standard| I/O que|
|00001d10| 75 65 20 66 69 65 6c 64 | 73 3a 0d 20 20 20 20 54 |ue field|s:. T|
|00001d20| 59 50 45 20 50 61 72 61 | 6d 42 6c 6f 63 6b 52 65 |YPE Para|mBlockRe|
|00001d30| 63 20 3d 20 52 45 43 4f | 52 44 0d 20 20 20 20 20 |c = RECO|RD. |
|00001d40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001d50| 20 20 20 20 20 20 20 71 | 4c 69 6e 6b 3a 20 20 20 | q|Link: |
|00001d60| 20 20 20 20 20 20 51 45 | 6c 65 6d 50 74 72 3b 0d | QE|lemPtr;.|
|00001d70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001d80| 20 20 20 20 20 20 20 20 | 20 20 20 20 71 54 79 70 | | qTyp|
|00001d90| 65 3a 20 20 20 20 20 20 | 20 20 20 49 4e 54 45 47 |e: | INTEG|
|00001da0| 45 52 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ER;. | |
|00001db0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001dc0| 69 6f 54 72 61 70 3a 20 | 20 20 20 20 20 20 20 49 |ioTrap: | I|
|00001dd0| 4e 54 45 47 45 52 3b 0d | 20 20 20 20 20 20 20 20 |NTEGER;.| |
|00001de0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001df0| 20 20 20 20 69 6f 43 6d | 64 41 64 64 72 3a 20 20 | ioCm|dAddr: |
|00001e00| 20 20 20 50 74 72 3b 0d | 20 20 20 20 20 20 20 20 | Ptr;.| |
|00001e10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001e20| 20 20 20 20 69 6f 43 6f | 6d 70 6c 65 74 69 6f 6e | ioCo|mpletion|
|00001e30| 3a 20 20 50 72 6f 63 50 | 74 72 3b 0d 20 20 20 20 |: ProcP|tr;. |
|00001e40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001e50| 20 20 20 20 20 20 20 20 | 69 6f 52 65 73 75 6c 74 | |ioResult|
|00001e60| 3a 20 20 20 20 20 20 4f | 53 45 72 72 3b 0d 20 20 |: O|SErr;. |
|00001e70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001e80| 20 20 20 20 20 20 20 20 | 20 20 69 6f 4e 61 6d 65 | | ioName|
|00001e90| 50 74 72 3a 20 20 20 20 | 20 53 74 72 69 6e 67 50 |Ptr: | StringP|
|00001ea0| 74 72 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |tr;. | |
|00001eb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ec0| 69 6f 56 52 65 66 4e 75 | 6d 3a 20 20 20 20 20 49 |ioVRefNu|m: I|
|00001ed0| 4e 54 45 47 45 52 3b 0d | 20 20 20 20 20 20 20 20 |NTEGER;.| |
|00001ee0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ef0| 20 20 20 20 69 6f 52 65 | 66 4e 75 6d 3a 20 20 20 | ioRe|fNum: |
|00001f00| 20 20 20 49 4e 54 45 47 | 45 52 3b 0d 20 20 20 20 | INTEG|ER;. |
|00001f10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001f20| 20 20 20 20 20 20 20 20 | 2e 2e 2e 0d 20 20 20 20 | |.... |
|00001f30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001f40| 20 20 20 20 20 45 4e 44 | 3b 0d 54 68 65 20 72 65 | END|;.The re|
|00001f50| 73 74 20 6f 66 20 74 68 | 65 20 70 61 72 61 6d 65 |st of th|e parame|
|00001f60| 74 65 72 20 62 6c 6f 63 | 6b 20 69 73 20 68 65 61 |ter bloc|k is hea|
|00001f70| 76 69 6c 79 20 64 65 70 | 65 6e 64 65 6e 74 20 6f |vily dep|endent o|
|00001f80| 6e 20 74 68 65 20 64 65 | 76 69 63 65 20 64 72 69 |n the de|vice dri|
|00001f90| 76 65 72 20 74 68 61 74 | 20 75 73 65 73 20 69 74 |ver that| uses it|
|00001fa0| 20 61 6e 64 20 77 68 61 | 74 20 6b 69 6e 64 20 6f | and wha|t kind o|
|00001fb0| 66 20 64 72 69 76 65 72 | 20 63 61 6c 6c 20 69 73 |f driver| call is|
|00001fc0| 20 62 65 69 6e 67 20 6d | 61 64 65 2e 0d 46 69 67 | being m|ade..Fig|
|00001fd0| 75 72 65 20 31 d1 42 61 | 73 69 63 20 44 65 76 69 |ure 1.Ba|sic Devi|
|00001fe0| 63 65 20 4d 61 6e 61 67 | 65 72 20 44 61 74 61 20 |ce Manag|er Data |
|00001ff0| 53 74 72 75 63 74 75 72 | 65 73 0d 54 68 65 20 55 |Structur|es.The U|
|00002000| 6e 69 74 20 54 61 62 6c | 65 2c 20 74 68 65 20 44 |nit Tabl|e, the D|
|00002010| 43 45 2c 20 61 6e 64 20 | 74 68 65 20 50 61 72 61 |CE, and |the Para|
|00002020| 6d 65 74 65 72 20 42 6c | 6f 63 6b 20 61 6c 6c 20 |meter Bl|ock all |
|00002030| 77 6f 72 6b 20 74 6f 67 | 65 74 68 65 72 20 74 6f |work tog|ether to|
|00002040| 20 70 72 6f 76 69 64 65 | 20 61 6c 6c 20 74 68 65 | provide| all the|
|00002050| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 6e 65 63 | informa|tion nec|
|00002060| 65 73 73 61 72 79 20 66 | 6f 72 20 74 68 65 20 61 |essary f|or the a|
|00002070| 70 70 6c 69 63 61 74 69 | 6f 6e 2c 20 44 65 76 69 |pplicati|on, Devi|
|00002080| 63 65 20 4d 61 6e 61 67 | 65 72 2c 20 61 6e 64 20 |ce Manag|er, and |
|00002090| 64 65 76 69 63 65 20 64 | 72 69 76 65 72 20 74 6f |device d|river to|
|000020a0| 20 63 6f 6d 6d 75 6e 69 | 63 61 74 65 20 77 69 74 | communi|cate wit|
|000020b0| 68 20 6f 6e 65 20 61 6e | 6f 74 68 65 72 2e 20 46 |h one an|other. F|
|000020c0| 6f 72 20 65 78 61 6d 70 | 6c 65 2c 20 74 68 65 20 |or examp|le, the |
|000020d0| 73 74 72 75 63 74 75 72 | 65 20 6f 66 20 61 20 52 |structur|e of a R|
|000020e0| 41 4d 2d 62 61 73 65 64 | 20 64 72 69 76 65 72 20 |AM-based| driver |
|000020f0| 74 68 61 74 20 68 61 73 | 20 62 65 65 6e 20 6f 70 |that has| been op|
|00002100| 65 6e 65 64 20 61 6e 64 | 20 63 61 6c 6c 65 64 20 |ened and| called |
|00002110| 61 73 79 6e 63 68 72 6f | 6e 6f 75 73 6c 79 20 61 |asynchro|nously a|
|00002120| 20 66 65 77 20 74 69 6d | 65 73 20 6d 69 67 68 74 | few tim|es might|
|00002130| 20 6c 6f 6f 6b 20 6c 69 | 6b 65 20 74 68 61 74 20 | look li|ke that |
|00002140| 73 68 6f 77 6e 20 69 6e | 20 46 69 67 75 72 65 20 |shown in| Figure |
|00002150| 31 2e 0d 52 6f 75 74 69 | 6e 65 20 4d 61 69 6e 74 |1..Routi|ne Maint|
|00002160| 65 6e 61 6e 63 65 0d 41 | 20 64 65 76 69 63 65 20 |enance.A| device |
|00002170| 64 72 69 76 65 72 20 69 | 73 20 61 20 62 6c 6f 63 |driver i|s a bloc|
|00002180| 6b 20 6f 66 20 64 61 74 | 61 20 63 6f 6d 70 6f 73 |k of dat|a compos|
|00002190| 65 64 20 6f 66 20 61 20 | 68 65 61 64 65 72 20 66 |ed of a |header f|
|000021a0| 6f 6c 6c 6f 77 65 64 20 | 62 79 20 65 78 65 63 75 |ollowed |by execu|
|000021b0| 74 61 62 6c 65 20 63 6f | 64 65 2e 20 54 68 65 20 |table co|de. The |
|000021c0| 68 65 61 64 65 72 20 63 | 6f 6e 74 61 69 6e 73 20 |header c|ontains |
|000021d0| 66 6c 61 67 73 2c 20 61 | 20 64 65 6c 61 79 20 61 |flags, a| delay a|
|000021e0| 6d 6f 75 6e 74 2c 20 61 | 6e 20 65 76 65 6e 74 20 |mount, a|n event |
|000021f0| 6d 61 73 6b 2c 20 61 20 | 6d 65 6e 75 20 49 44 2c |mask, a |menu ID,|
|00002200| 20 61 6e 20 6f 70 74 69 | 6f 6e 61 6c 20 6e 61 6d | an opti|onal nam|
|00002210| 65 20 6f 66 20 74 68 65 | 20 64 72 69 76 65 72 2c |e of the| driver,|
|00002220| 20 61 6e 64 20 6f 66 66 | 73 65 74 73 20 74 6f 20 | and off|sets to |
|00002230| 74 68 65 20 72 6f 75 74 | 69 6e 65 73 20 74 68 61 |the rout|ines tha|
|00002240| 74 20 61 72 65 20 69 6e | 20 74 68 65 20 65 78 65 |t are in| the exe|
|00002250| 63 75 74 61 62 6c 65 20 | 63 6f 64 65 2e 20 49 6e |cutable |code. In|
|00002260| 73 69 64 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 64 |side Mac|intosh d|
|00002270| 65 73 63 72 69 62 65 73 | 20 64 65 76 69 63 65 20 |escribes| device |
|00002280| 64 72 69 76 65 72 73 20 | 61 73 20 62 65 69 6e 67 |drivers |as being|
|00002290| 20 27 44 52 56 52 27 20 | 72 65 73 6f 75 72 63 65 | 'DRVR' |resource|
|000022a0| 73 2e 20 41 6c 74 68 6f | 75 67 68 20 74 68 69 73 |s. Altho|ugh this|
|000022b0| 20 69 73 20 74 79 70 69 | 63 61 6c 6c 79 20 74 68 | is typi|cally th|
|000022c0| 65 20 63 61 73 65 2c 20 | 69 74 20 73 68 6f 75 6c |e case, |it shoul|
|000022d0| 64 20 62 65 20 6e 6f 74 | 65 64 20 74 68 61 74 20 |d be not|ed that |
|000022e0| 74 68 69 73 20 69 73 20 | 6e 6f 74 20 6e 65 63 65 |this is |not nece|
|000022f0| 73 73 61 72 69 6c 79 20 | 61 20 72 65 71 75 69 72 |ssarily |a requir|
|00002300| 65 6d 65 6e 74 2c 20 61 | 73 20 6c 6f 6e 67 20 61 |ement, a|s long a|
|00002310| 73 20 63 65 72 74 61 69 | 6e 20 72 75 6c 65 73 20 |s certai|n rules |
|00002320| 61 72 65 20 66 6f 6c 6c | 6f 77 65 64 2e 20 44 65 |are foll|owed. De|
|00002330| 74 61 69 6c 73 20 6f 66 | 20 74 68 65 73 65 20 72 |tails of| these r|
|00002340| 75 6c 65 73 20 61 72 65 | 20 64 69 73 63 75 73 73 |ules are| discuss|
|00002350| 65 64 20 6c 61 74 65 72 | 20 69 6e 20 74 68 69 73 |ed later| in this|
|00002360| 20 4e 6f 74 65 2e 0d 41 | 20 64 65 76 69 63 65 20 | Note..A| device |
|00002370| 64 72 69 76 65 72 20 63 | 61 6e 20 69 6d 70 6c 65 |driver c|an imple|
|00002380| 6d 65 6e 74 20 66 69 76 | 65 20 72 6f 75 74 69 6e |ment fiv|e routin|
|00002390| 65 73 2e 20 54 68 65 20 | 44 65 76 69 63 65 20 4d |es. The |Device M|
|000023a0| 61 6e 61 67 65 72 20 63 | 61 6c 6c 73 20 74 68 65 |anager c|alls the|
|000023b0| 73 65 20 72 6f 75 74 69 | 6e 65 73 20 77 68 65 6e |se routi|nes when|
|000023c0| 20 63 65 72 74 61 69 6e | 20 6f 70 65 72 61 74 69 | certain| operati|
|000023d0| 6e 67 20 73 79 73 74 65 | 6d 20 74 72 61 70 73 20 |ng syste|m traps |
|000023e0| 61 72 65 20 65 78 65 63 | 75 74 65 64 2e 20 54 68 |are exec|uted. Th|
|000023f0| 65 20 74 72 61 70 73 20 | 61 72 65 20 63 61 6c 6c |e traps |are call|
|00002400| 65 64 20 77 69 74 68 20 | 72 65 67 69 73 74 65 72 |ed with |register|
|00002410| 20 41 30 20 70 6f 69 6e | 74 69 6e 67 20 74 6f 20 | A0 poin|ting to |
|00002420| 74 68 65 20 70 61 72 61 | 6d 65 74 65 72 20 62 6c |the para|meter bl|
|00002430| 6f 63 6b 2e 20 53 6f 6d | 65 20 6f 66 20 74 68 65 |ock. Som|e of the|
|00002440| 73 65 20 74 72 61 70 73 | 20 63 61 6e 20 62 65 20 |se traps| can be |
|00002450| 63 61 6c 6c 65 64 20 69 | 6e 20 6f 6e 65 20 6f 66 |called i|n one of|
|00002460| 20 74 77 6f 20 64 69 66 | 66 65 72 65 6e 74 20 6d | two dif|ferent m|
|00002470| 6f 64 65 73 3a 20 69 6d | 6d 65 64 69 61 74 65 20 |odes: im|mediate |
|00002480| 61 6e 64 20 61 73 79 6e | 63 68 72 6f 6e 6f 75 73 |and asyn|chronous|
|00002490| 2e 20 49 66 20 62 69 74 | 20 39 20 6f 66 20 74 68 |. If bit| 9 of th|
|000024a0| 65 20 74 72 61 70 20 77 | 6f 72 64 20 69 73 20 73 |e trap w|ord is s|
|000024b0| 65 74 2c 20 74 68 65 20 | 63 61 6c 6c 20 69 73 20 |et, the |call is |
|000024c0| 69 6d 6d 65 64 69 61 74 | 65 2c 20 77 68 69 6c 65 |immediat|e, while|
|000024d0| 20 69 66 20 62 69 74 20 | 31 30 20 69 73 20 73 65 | if bit |10 is se|
|000024e0| 74 2c 20 74 68 65 20 63 | 61 6c 6c 20 69 73 20 61 |t, the c|all is a|
|000024f0| 73 79 6e 63 68 72 6f 6e | 6f 75 73 2e 20 54 68 65 |synchron|ous. The|
|00002500| 20 64 65 76 69 63 65 20 | 64 72 69 76 65 72 20 73 | device |driver s|
|00002510| 68 6f 75 6c 64 20 62 65 | 20 61 62 6c 65 20 74 6f |hould be| able to|
|00002520| 20 72 65 73 70 6f 6e 64 | 20 74 6f 20 65 76 65 72 | respond| to ever|
|00002530| 79 20 63 61 6c 6c 20 62 | 79 20 74 68 65 20 44 65 |y call b|y the De|
|00002540| 76 69 63 65 20 4d 61 6e | 61 67 65 72 20 69 6e 20 |vice Man|ager in |
|00002550| 61 74 20 6c 65 61 73 74 | 20 73 6f 6d 65 20 66 61 |at least| some fa|
|00002560| 73 68 69 6f 6e 2c 20 65 | 76 65 6e 20 69 66 20 6a |shion, e|ven if j|
|00002570| 75 73 74 20 74 6f 20 72 | 65 74 75 72 6e 2e 20 54 |ust to r|eturn. T|
|00002580| 68 65 20 64 65 76 69 63 | 65 20 64 72 69 76 65 72 |he devic|e driver|
|00002590| 20 72 6f 75 74 69 6e 65 | 73 2c 20 74 68 65 20 74 | routine|s, the t|
|000025a0| 72 61 70 73 20 74 68 61 | 74 20 63 61 75 73 65 20 |raps tha|t cause |
|000025b0| 74 68 65 20 44 65 76 69 | 63 65 20 4d 61 6e 61 67 |the Devi|ce Manag|
|000025c0| 65 72 20 74 6f 20 63 61 | 6c 6c 20 74 68 65 20 72 |er to ca|ll the r|
|000025d0| 6f 75 74 69 6e 65 73 2c | 20 61 6e 64 20 74 68 65 |outines,| and the|
|000025e0| 20 76 61 72 69 6f 75 73 | 20 6d 6f 64 65 73 20 69 | various| modes i|
|000025f0| 6e 20 77 68 69 63 68 20 | 74 68 65 20 63 61 6c 6c |n which |the call|
|00002600| 73 20 63 61 6e 20 62 65 | 20 6d 61 64 65 20 61 72 |s can be| made ar|
|00002610| 65 20 61 73 20 66 6f 6c | 6c 6f 77 73 3a 0d 52 6f |e as fol|lows:.Ro|
|00002620| 75 74 69 6e 65 09 54 72 | 61 70 09 4d 6f 64 65 73 |utine.Tr|ap.Modes|
|00002630| 0d 4f 70 65 6e 09 5f 4f | 70 65 6e 09 49 6d 6d 65 |.Open._O|pen.Imme|
|00002640| 64 69 61 74 65 0d 50 72 | 69 6d 65 09 5f 52 65 61 |diate.Pr|ime._Rea|
|00002650| 64 2c 20 5f 57 72 69 74 | 65 09 49 6d 6d 65 64 69 |d, _Writ|e.Immedi|
|00002660| 61 74 65 2c 20 41 73 79 | 6e 63 68 72 6f 6e 6f 75 |ate, Asy|nchronou|
|00002670| 73 0d 43 6f 6e 74 72 6f | 6c 09 5f 43 6f 6e 74 72 |s.Contro|l._Contr|
|00002680| 6f 6c 09 49 6d 6d 65 64 | 69 61 74 65 2c 20 41 73 |ol.Immed|iate, As|
|00002690| 79 6e 63 68 72 6f 6e 6f | 75 73 0d 43 6f 6e 74 72 |ynchrono|us.Contr|
|000026a0| 6f 6c 09 5f 4b 69 6c 6c | 49 4f 09 49 6d 6d 65 64 |ol._Kill|IO.Immed|
|000026b0| 69 61 74 65 0d 53 74 61 | 74 75 73 09 5f 53 74 61 |iate.Sta|tus._Sta|
|000026c0| 74 75 73 09 49 6d 6d 65 | 64 69 61 74 65 2c 20 41 |tus.Imme|diate, A|
|000026d0| 73 79 6e 63 68 72 6f 6e | 6f 75 73 0d 43 6c 6f 73 |synchron|ous.Clos|
|000026e0| 65 09 5f 43 6c 6f 73 65 | 09 49 6d 6d 65 64 69 61 |e._Close|.Immedia|
|000026f0| 74 65 0d 5f 4f 70 65 6e | 2c 20 5f 43 6c 6f 73 65 |te._Open|, _Close|
|00002700| 2c 20 61 6e 64 20 5f 4b | 69 6c 6c 49 4f 20 61 72 |, and _K|illIO ar|
|00002710| 65 20 61 6c 77 61 79 73 | 20 69 6d 6d 65 64 69 61 |e always| immedia|
|00002720| 74 65 20 62 65 63 61 75 | 73 65 20 6f 66 20 74 68 |te becau|se of th|
|00002730| 65 20 77 61 79 20 74 68 | 65 79 20 61 72 65 20 68 |e way th|ey are h|
|00002740| 61 6e 64 6c 65 64 20 62 | 79 20 74 68 65 20 44 65 |andled b|y the De|
|00002750| 76 69 63 65 20 4d 61 6e | 61 67 65 72 2e 20 44 6f |vice Man|ager. Do|
|00002760| 20 6e 6f 74 20 6d 61 6b | 65 20 61 73 79 6e 63 68 | not mak|e asynch|
|00002770| 72 6f 6e 6f 75 73 20 5f | 4f 70 65 6e 2c 20 5f 43 |ronous _|Open, _C|
|00002780| 6c 6f 73 65 2c 20 6f 72 | 20 5f 4b 69 6c 6c 49 4f |lose, or| _KillIO|
|00002790| 20 63 61 6c 6c 73 2c 20 | 61 6e 64 20 64 6f 20 6e | calls, |and do n|
|000027a0| 6f 74 20 73 70 65 63 69 | 66 79 20 74 68 65 20 49 |ot speci|fy the I|
|000027b0| 4d 4d 45 44 20 62 69 74 | 20 66 6f 72 20 74 68 65 |MMED bit| for the|
|000027c0| 6d 20 65 78 70 6c 69 63 | 69 74 6c 79 2e 20 49 74 |m explic|itly. It|
|000027d0| 20 69 73 20 65 78 74 72 | 65 6d 65 6c 79 20 72 61 | is extr|emely ra|
|000027e0| 72 65 20 74 68 61 74 20 | 61 20 64 72 69 76 65 72 |re that |a driver|
|000027f0| 20 77 69 6c 6c 20 73 75 | 70 70 6f 72 74 20 69 6d | will su|pport im|
|00002800| 6d 65 64 69 61 74 65 20 | 5f 52 65 61 64 20 61 6e |mediate |_Read an|
|00002810| 64 20 5f 57 72 69 74 65 | 20 63 61 6c 6c 73 20 70 |d _Write| calls p|
|00002820| 72 6f 70 65 72 6c 79 2e | 20 54 68 65 73 65 20 63 |roperly.| These c|
|00002830| 61 6c 6c 73 20 73 68 6f | 75 6c 64 20 62 65 20 75 |alls sho|uld be u|
|00002840| 73 65 64 20 6f 6e 6c 79 | 20 77 68 65 6e 20 73 70 |sed only| when sp|
|00002850| 65 63 69 66 69 63 61 6c | 6c 79 20 61 6c 6c 6f 77 |ecifical|ly allow|
|00002860| 65 64 20 61 63 63 6f 72 | 64 69 6e 67 20 74 6f 20 |ed accor|ding to |
|00002870| 74 68 65 20 64 6f 63 75 | 6d 65 6e 74 61 74 69 6f |the docu|mentatio|
|00002880| 6e 20 66 6f 72 20 61 20 | 64 72 69 76 65 72 2e 0d |n for a |driver..|
|00002890| 46 72 6f 6d 20 74 68 65 | 20 64 72 69 76 65 72 d5 |From the| driver.|
|000028a0| 73 20 70 6f 69 6e 74 20 | 6f 66 20 76 69 65 77 2c |s point |of view,|
|000028b0| 20 4b 69 6c 6c 49 4f 20 | 69 73 20 68 61 6e 64 6c | KillIO |is handl|
|000028c0| 65 64 20 61 73 20 61 20 | 5f 43 6f 6e 74 72 6f 6c |ed as a |_Control|
|000028d0| 20 63 61 6c 6c 20 77 69 | 74 68 20 61 20 63 73 43 | call wi|th a csC|
|000028e0| 6f 64 65 20 3d 20 31 2e | 20 48 6f 77 65 76 65 72 |ode = 1.| However|
|000028f0| 2c 20 74 68 69 73 20 69 | 73 20 61 20 66 61 8d 61 |, this i|s a fa.a|
|00002900| 64 65 20 70 72 6f 64 75 | 63 65 64 20 61 72 74 69 |de produ|ced arti|
|00002910| 66 69 63 69 61 6c 6c 79 | 20 62 79 20 74 68 65 20 |ficially| by the |
|00002920| 44 65 76 69 63 65 20 4d | 61 6e 61 67 65 72 2e 20 |Device M|anager. |
|00002930| 43 61 6c 6c 69 6e 67 20 | 61 20 64 72 69 76 65 72 |Calling |a driver|
|00002940| 20 77 69 74 68 20 5f 43 | 6f 6e 74 72 6f 6c 20 61 | with _C|ontrol a|
|00002950| 6e 64 20 63 73 43 6f 64 | 65 20 3d 20 31 20 69 73 |nd csCod|e = 1 is|
|00002960| 20 6e 6f 74 20 74 68 65 | 20 73 61 6d 65 20 74 68 | not the| same th|
|00002970| 69 6e 67 20 61 73 20 61 | 20 4b 69 6c 6c 49 4f 20 |ing as a| KillIO |
|00002980| 61 6e 64 20 6e 6f 6e 65 | 20 6f 66 20 74 68 65 20 |and none| of the |
|00002990| 6e 6f 72 6d 61 6c 20 64 | 65 71 75 65 75 65 69 6e |normal d|equeuein|
|000029a0| 67 20 61 63 74 69 6f 6e | 20 77 69 6c 6c 20 74 61 |g action| will ta|
|000029b0| 6b 65 20 70 6c 61 63 65 | 2e 0d 45 73 70 65 63 69 |ke place|..Especi|
|000029c0| 61 6c 6c 79 20 69 6d 70 | 6f 72 74 61 6e 74 3a 0d |ally imp|ortant:.|
|000029d0| 44 65 76 65 6c 6f 70 65 | 72 73 20 73 68 6f 75 6c |Develope|rs shoul|
|000029e0| 64 20 6e 65 76 65 72 20 | 6d 61 6b 65 20 61 20 44 |d never |make a D|
|000029f0| 65 76 69 63 65 20 4d 61 | 6e 61 67 65 72 20 63 61 |evice Ma|nager ca|
|00002a00| 6c 6c 20 61 74 20 69 6e | 74 65 72 72 75 70 74 20 |ll at in|terrupt |
|00002a10| 74 69 6d 65 2c 20 69 6e | 63 6c 75 64 69 6e 67 20 |time, in|cluding |
|00002a20| 56 42 4c 73 2c 20 54 69 | 6d 65 20 4d 61 6e 61 67 |VBLs, Ti|me Manag|
|00002a30| 65 72 20 74 61 73 6b 73 | 2c 20 64 65 66 65 72 72 |er tasks|, deferr|
|00002a40| 65 64 20 74 61 73 6b 73 | 2c 20 61 6e 64 20 73 6f |ed tasks|, and so|
|00002a50| 20 6f 6e 2c 20 75 6e 6c | 65 73 73 20 74 68 65 20 | on, unl|ess the |
|00002a60| 63 61 6c 6c 20 69 73 20 | 61 73 79 6e 63 68 72 6f |call is |asynchro|
|00002a70| 6e 6f 75 73 20 61 6e 64 | 20 74 68 65 20 75 6e 64 |nous and| the und|
|00002a80| 65 72 6c 79 69 6e 67 20 | 64 72 69 76 65 72 20 69 |erlying |driver i|
|00002a90| 73 20 63 61 70 61 62 6c | 65 20 6f 66 20 72 65 74 |s capabl|e of ret|
|00002aa0| 75 72 6e 69 6e 67 20 74 | 6f 20 74 68 65 20 63 61 |urning t|o the ca|
|00002ab0| 6c 6c 65 72 20 62 65 66 | 6f 72 65 20 74 68 65 20 |ller bef|ore the |
|00002ac0| 49 2f 4f 20 63 6f 6d 70 | 6c 65 74 65 73 2e 20 44 |I/O comp|letes. D|
|00002ad0| 65 76 69 61 74 69 6f 6e | 73 20 66 72 6f 6d 20 74 |eviation|s from t|
|00002ae0| 68 69 73 20 70 72 61 63 | 74 69 63 65 20 77 69 6c |his prac|tice wil|
|00002af0| 6c 20 72 65 73 75 6c 74 | 20 69 6e 20 73 65 76 65 |l result| in seve|
|00002b00| 72 65 20 69 6e 74 65 72 | 72 75 70 74 20 6c 61 74 |re inter|rupt lat|
|00002b10| 65 6e 63 79 20 6f 72 20 | 65 76 65 6e 20 73 79 73 |ency or |even sys|
|00002b20| 74 65 6d 20 68 61 6e 67 | 73 2e 0d 57 68 61 74 20 |tem hang|s..What |
|00002b30| 74 68 65 20 47 6c 75 65 | 20 44 6f 0d 48 69 67 68 |the Glue| Do.High|
|00002b40| 2d 6c 65 76 65 6c 20 6c | 61 6e 67 75 61 67 65 73 |-level l|anguages|
|00002b50| 20 6f 66 74 65 6e 20 63 | 6f 6d 65 20 77 69 74 68 | often c|ome with|
|00002b60| 20 6c 69 62 72 61 72 69 | 65 73 20 74 68 61 74 20 | librari|es that |
|00002b70| 70 72 6f 76 69 64 65 20 | 61 6e 20 65 61 73 79 2d |provide |an easy-|
|00002b80| 74 6f 2d 75 73 65 20 69 | 6e 74 65 72 66 61 63 65 |to-use i|nterface|
|00002b90| 20 28 d2 67 6c 75 65 d3 | 29 20 74 6f 20 74 68 65 | (.glue.|) to the|
|00002ba0| 20 6d 61 63 68 69 6e 65 | 2d 6c 65 76 65 6c 20 44 | machine|-level D|
|00002bb0| 65 76 69 63 65 20 4d 61 | 6e 61 67 65 72 20 74 72 |evice Ma|nager tr|
|00002bc0| 61 70 73 2e 20 4d 61 6e | 79 20 6f 66 20 74 68 65 |aps. Man|y of the|
|00002bd0| 73 65 20 63 61 6c 6c 73 | 20 61 72 65 20 64 6f 63 |se calls| are doc|
|00002be0| 75 6d 65 6e 74 65 64 20 | 69 6e 20 49 6e 73 69 64 |umented |in Insid|
|00002bf0| 65 20 4d 61 63 69 6e 74 | 6f 73 68 2e 20 54 68 65 |e Macint|osh. The|
|00002c00| 73 65 20 72 6f 75 74 69 | 6e 65 73 20 61 72 65 20 |se routi|nes are |
|00002c10| 66 75 72 74 68 65 72 20 | 64 69 76 69 64 65 64 20 |further |divided |
|00002c20| 69 6e 74 6f 20 74 77 6f | 20 67 72 6f 75 70 73 2e |into two| groups.|
|00002c30| 20 54 68 65 20 66 69 72 | 73 74 20 67 72 6f 75 70 | The fir|st group|
|00002c40| 20 69 73 20 63 6f 6d 70 | 6f 73 65 64 20 6f 66 20 | is comp|osed of |
|00002c50| d2 6c 6f 77 2d 6c 65 76 | 65 6c d3 20 72 6f 75 74 |.low-lev|el. rout|
|00002c60| 69 6e 65 73 3b 20 74 68 | 65 73 65 20 72 6f 75 74 |ines; th|ese rout|
|00002c70| 69 6e 65 73 20 74 61 6b | 65 20 61 6e 20 61 6c 72 |ines tak|e an alr|
|00002c80| 65 61 64 79 20 63 6f 6d | 70 6c 65 74 65 20 70 61 |eady com|plete pa|
|00002c90| 72 61 6d 65 74 65 72 20 | 62 6c 6f 63 6b 20 70 61 |rameter |block pa|
|00002ca0| 73 73 65 64 20 74 6f 20 | 74 68 65 6d 2c 20 70 6f |ssed to |them, po|
|00002cb0| 69 6e 74 20 72 65 67 69 | 73 74 65 72 20 41 30 20 |int regi|ster A0 |
|00002cc0| 61 74 20 69 74 2c 20 61 | 6e 64 20 65 78 65 63 75 |at it, a|nd execu|
|00002cd0| 74 65 20 74 68 65 20 70 | 72 6f 70 65 72 20 74 72 |te the p|roper tr|
|00002ce0| 61 70 20 77 69 74 68 20 | 74 68 65 20 63 6f 72 72 |ap with |the corr|
|00002cf0| 65 63 74 20 6d 6f 64 65 | 2e 20 54 68 65 20 73 65 |ect mode|. The se|
|00002d00| 63 6f 6e 64 20 67 72 6f | 75 70 20 69 73 20 63 6f |cond gro|up is co|
|00002d10| 6d 70 6f 73 65 64 20 6f | 66 20 d2 68 69 67 68 2d |mposed o|f .high-|
|00002d20| 6c 65 76 65 6c d3 20 72 | 6f 75 74 69 6e 65 73 2c |level. r|outines,|
|00002d30| 20 77 68 69 63 68 20 73 | 65 74 20 75 70 20 61 20 | which s|et up a |
|00002d40| 70 61 72 61 6d 65 74 65 | 72 20 62 6c 6f 63 6b 20 |paramete|r block |
|00002d50| 61 6e 64 20 72 65 71 75 | 69 72 65 64 20 72 65 67 |and requ|ired reg|
|00002d60| 69 73 74 65 72 73 20 77 | 69 74 68 20 64 61 74 61 |isters w|ith data|
|00002d70| 20 70 72 6f 76 69 64 65 | 64 20 69 6e 20 74 68 65 | provide|d in the|
|00002d80| 20 63 61 6c 6c 20 70 61 | 72 61 6d 65 74 65 72 73 | call pa|rameters|
|00002d90| 2c 20 74 68 65 6e 20 65 | 78 65 63 75 74 65 20 74 |, then e|xecute t|
|00002da0| 68 65 20 44 65 76 69 63 | 65 20 4d 61 6e 61 67 65 |he Devic|e Manage|
|00002db0| 72 20 74 72 61 70 73 2e | 20 46 6f 72 20 65 78 61 |r traps.| For exa|
|00002dc0| 6d 70 6c 65 2c 20 74 68 | 65 20 4f 70 65 6e 44 72 |mple, th|e OpenDr|
|00002dd0| 69 76 65 72 20 63 61 6c | 6c 20 63 72 65 61 74 65 |iver cal|l create|
|00002de0| 73 20 61 20 70 61 72 61 | 6d 65 74 65 72 20 62 6c |s a para|meter bl|
|00002df0| 6f 63 6b 20 6f 6e 20 74 | 68 65 20 73 74 61 63 6b |ock on t|he stack|
|00002e00| 2c 20 63 6f 6d 70 6c 65 | 74 65 73 20 74 68 65 20 |, comple|tes the |
|00002e10| 72 65 71 75 69 72 65 64 | 20 66 69 65 6c 64 73 2c |required| fields,|
|00002e20| 20 70 6f 69 6e 74 73 20 | 72 65 67 69 73 74 65 72 | points |register|
|00002e30| 20 41 30 20 74 6f 20 74 | 68 65 20 62 6c 6f 63 6b | A0 to t|he block|
|00002e40| 2c 20 61 6e 64 20 65 78 | 65 63 75 74 65 73 20 74 |, and ex|ecutes t|
|00002e50| 68 65 20 5f 4f 70 65 6e | 20 74 72 61 70 2e 0d 46 |he _Open| trap..F|
|00002e60| 6f 6c 6c 6f 77 69 6e 67 | 20 69 73 20 61 20 6c 69 |ollowing| is a li|
|00002e70| 73 74 20 6f 66 20 68 69 | 67 68 2d 6c 65 76 65 6c |st of hi|gh-level|
|00002e80| 20 72 6f 75 74 69 6e 65 | 73 20 61 6e 64 20 74 68 | routine|s and th|
|00002e90| 65 20 74 72 61 70 20 67 | 6c 75 65 20 74 68 65 79 |e trap g|lue they|
|00002ea0| 20 65 78 65 63 75 74 65 | 3a 0d 52 6f 75 74 69 6e | execute|:.Routin|
|00002eb0| 65 09 54 72 61 70 0d 4f | 70 65 6e 44 72 69 76 65 |e.Trap.O|penDrive|
|00002ec0| 72 09 5f 4f 70 65 6e 0d | 43 6c 6f 73 65 44 72 69 |r._Open.|CloseDri|
|00002ed0| 76 65 72 09 5f 43 6c 6f | 73 65 0d 46 53 52 65 61 |ver._Clo|se.FSRea|
|00002ee0| 64 09 5f 52 65 61 64 0d | 46 53 57 72 69 74 65 09 |d._Read.|FSWrite.|
|00002ef0| 5f 57 72 69 74 65 0d 43 | 6f 6e 74 72 6f 6c 09 5f |_Write.C|ontrol._|
|00002f00| 43 6f 6e 74 72 6f 6c 0d | 53 74 61 74 75 73 09 5f |Control.|Status._|
|00002f10| 53 74 61 74 75 73 0d 4b | 69 6c 6c 49 4f 09 5f 4b |Status.K|illIO._K|
|00002f20| 69 6c 6c 49 4f 0d 59 65 | 73 2c 20 57 65 d5 72 65 |illIO.Ye|s, We.re|
|00002f30| 20 4f 70 65 6e 0d 54 68 | 65 20 4f 70 65 6e 20 72 | Open.Th|e Open r|
|00002f40| 6f 75 74 69 6e 65 20 6f | 66 20 61 20 64 65 76 69 |outine o|f a devi|
|00002f50| 63 65 20 64 72 69 76 65 | 72 20 69 73 20 63 61 6c |ce drive|r is cal|
|00002f60| 6c 65 64 20 61 73 20 61 | 20 72 65 73 75 6c 74 20 |led as a| result |
|00002f70| 6f 66 20 61 6e 20 5f 4f | 70 65 6e 20 74 72 61 70 |of an _O|pen trap|
|00002f80| 20 62 65 69 6e 67 20 65 | 78 65 63 75 74 65 64 2e | being e|xecuted.|
|00002f90| 20 57 68 61 74 20 5f 4f | 70 65 6e 20 64 6f 65 73 | What _O|pen does|
|00002fa0| 20 64 65 70 65 6e 64 73 | 20 6f 6e 20 77 68 61 74 | depends| on what|
|00002fb0| 20 6d 61 63 68 69 6e 65 | 20 69 73 20 72 75 6e 6e | machine| is runn|
|00002fc0| 69 6e 67 2c 20 62 75 74 | 20 69 73 20 66 61 69 72 |ing, but| is fair|
|00002fd0| 6c 79 20 63 6f 6e 73 69 | 73 74 65 6e 74 20 61 63 |ly consi|stent ac|
|00002fe0| 72 6f 73 73 20 74 68 65 | 20 6d 61 63 68 69 6e 65 |ross the| machine|
|00002ff0| 20 6d 6f 64 65 6c 73 2c | 20 77 69 74 68 20 74 68 | models,| with th|
|00003000| 65 20 65 78 63 65 70 74 | 69 6f 6e 20 6f 66 20 4e |e except|ion of N|
|00003010| 75 42 75 73 aa 20 73 6c | 6f 74 20 64 72 69 76 65 |uBus. sl|ot drive|
|00003020| 72 73 20 6f 6e 20 61 20 | 4d 61 63 69 6e 74 6f 73 |rs on a |Macintos|
|00003030| 68 20 77 69 74 68 20 61 | 20 53 6c 6f 74 20 4d 61 |h with a| Slot Ma|
|00003040| 6e 61 67 65 72 2e 20 54 | 68 65 20 66 6f 6c 6c 6f |nager. T|he follo|
|00003050| 77 69 6e 67 20 69 73 20 | 61 20 70 73 65 75 64 6f |wing is |a pseudo|
|00003060| 2d 63 6f 64 65 20 64 65 | 73 63 72 69 70 74 69 6f |-code de|scriptio|
|00003070| 6e 20 66 6f 6c 6c 6f 77 | 65 64 20 62 79 20 61 20 |n follow|ed by a |
|00003080| 6e 61 72 72 61 74 69 76 | 65 3a 0d 49 46 20 63 61 |narrativ|e:.IF ca|
|00003090| 6c 6c 20 69 73 20 4e 4f | 54 20 66 72 6f 6d 20 5f |ll is NO|T from _|
|000030a0| 4f 70 65 6e 44 65 73 6b | 41 63 63 20 41 4e 44 20 |OpenDesk|Acc AND |
|000030b0| 66 69 6c 65 6e 61 6d 65 | 20 64 6f 65 73 20 4e 4f |filename| does NO|
|000030c0| 54 20 62 65 67 69 6e 20 | 77 69 74 68 20 d2 2e d3 |T begin |with ...|
|000030d0| 20 54 48 45 4e 0d 20 20 | 20 20 70 61 73 73 20 63 | THEN. | pass c|
|000030e0| 6f 6e 74 72 6f 6c 20 74 | 6f 20 66 69 6c 65 20 73 |ontrol t|o file s|
|000030f0| 79 73 74 65 6d 0d 45 4c | 53 45 20 5b 0d 20 20 20 |ystem.EL|SE [. |
|00003100| 20 49 46 20 64 72 69 76 | 65 72 20 69 73 20 66 6f | IF driv|er is fo|
|00003110| 72 20 73 6c 6f 74 20 64 | 65 76 69 63 65 20 54 48 |r slot d|evice TH|
|00003120| 45 4e 20 5b 20 20 20 20 | 7b 65 78 70 6c 61 69 6e |EN [ |{explain|
|00003130| 65 64 20 69 6e 20 6e 61 | 72 72 61 74 69 76 65 20 |ed in na|rrative |
|00003140| 62 65 6c 6f 77 7d 0d 20 | 20 20 20 20 20 20 20 73 |below}. | s|
|00003150| 65 61 72 63 68 20 75 6e | 69 74 20 74 61 62 6c 65 |earch un|it table|
|00003160| 20 66 72 6f 6d 20 34 38 | 20 74 68 72 6f 75 67 68 | from 48| through|
|00003170| 20 55 6e 69 74 4e 74 72 | 79 43 6e 74 20 66 6f 72 | UnitNtr|yCnt for|
|00003180| 20 6d 61 74 63 68 0d 20 | 20 20 20 20 20 20 20 49 | match. | I|
|00003190| 46 20 4e 4f 54 20 66 6f | 75 6e 64 20 54 48 45 4e |F NOT fo|und THEN|
|000031a0| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 63 61 6c |. | cal|
|000031b0| 6c 20 5f 47 65 74 4e 61 | 6d 65 64 52 65 73 6f 75 |l _GetNa|medResou|
|000031c0| 72 63 65 20 66 6f 72 20 | 64 72 69 76 65 72 20 6e |rce for |driver n|
|000031d0| 61 6d 65 20 74 79 70 65 | 20 27 44 52 56 52 27 0d |ame type| 'DRVR'.|
|000031e0| 20 20 20 20 20 20 20 20 | 49 46 20 4e 4f 54 20 73 | |IF NOT s|
|000031f0| 75 63 63 65 73 73 66 75 | 6c 20 54 48 45 4e 0d 20 |uccessfu|l THEN. |
|00003200| 20 20 20 20 20 20 20 20 | 20 20 20 63 61 6c 6c 20 | | call |
|00003210| 5f 53 47 65 74 44 72 69 | 76 65 72 20 66 6f 72 20 |_SGetDri|ver for |
|00003220| 64 72 69 76 65 72 0d 20 | 20 20 20 20 20 20 20 49 |driver. | I|
|00003230| 46 20 4e 4f 54 20 73 75 | 63 63 65 73 73 66 75 6c |F NOT su|ccessful|
|00003240| 20 54 48 45 4e 0d 20 20 | 20 20 20 20 20 20 20 20 | THEN. | |
|00003250| 20 20 72 65 74 75 72 6e | 20 65 72 72 6f 72 0d 20 | return| error. |
|00003260| 20 20 20 20 20 20 20 7b | 66 6f 75 6e 64 20 74 68 | {|found th|
|00003270| 65 20 64 72 69 76 65 72 | 7d 0d 20 20 20 20 20 20 |e driver|}. |
|00003280| 20 20 73 65 61 72 63 68 | 20 75 6e 69 74 20 74 61 | search| unit ta|
|00003290| 62 6c 65 20 66 72 6f 6d | 20 34 38 20 74 68 72 6f |ble from| 48 thro|
|000032a0| 75 67 68 20 55 6e 69 74 | 4e 74 72 79 43 6e 74 20 |ugh Unit|NtryCnt |
|000032b0| 66 6f 72 20 4e 49 4c 20 | 44 43 45 20 68 61 6e 64 |for NIL |DCE hand|
|000032c0| 6c 65 0d 20 20 20 20 20 | 20 20 20 49 46 20 4e 4f |le. | IF NO|
|000032d0| 54 20 66 6f 75 6e 64 20 | 54 48 45 4e 20 5b 0d 20 |T found |THEN [. |
|000032e0| 20 20 20 20 20 20 20 20 | 20 20 20 62 75 6d 70 20 | | bump |
|000032f0| 75 70 20 55 6e 69 74 4e | 74 72 79 43 6e 74 20 62 |up UnitN|tryCnt b|
|00003300| 79 20 34 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |y 4. | |
|00003310| 49 46 20 6d 61 78 69 6d | 75 6d 20 55 6e 69 74 4e |IF maxim|um UnitN|
|00003320| 74 72 79 43 6e 74 20 65 | 78 63 65 65 64 65 64 20 |tryCnt e|xceeded |
|00003330| 54 48 45 4e 0d 20 20 20 | 20 20 20 20 20 20 20 20 |THEN. | |
|00003340| 20 20 20 20 20 72 65 74 | 75 72 6e 20 65 72 72 6f | ret|urn erro|
|00003350| 72 20 5d 0d 20 20 20 20 | 20 20 20 20 7b 66 6f 75 |r ]. | {fou|
|00003360| 6e 64 20 61 20 73 6c 6f | 74 7d 0d 20 20 20 20 20 |nd a slo|t}. |
|00003370| 20 20 20 69 6e 73 74 61 | 6c 6c 20 64 72 69 76 65 | insta|ll drive|
|00003380| 72 20 5d 0d 20 20 20 20 | 45 4c 53 45 20 5b 0d 20 |r ]. |ELSE [. |
|00003390| 20 20 20 20 20 20 20 73 | 65 61 72 63 68 20 75 6e | s|earch un|
|000033a0| 69 74 20 74 61 62 6c 65 | 20 66 72 6f 6d 20 30 20 |it table| from 0 |
|000033b0| 74 68 72 6f 75 67 68 20 | 55 6e 69 74 4e 74 72 79 |through |UnitNtry|
|000033c0| 43 6e 74 20 66 6f 72 20 | 6d 61 74 63 68 0d 20 20 |Cnt for |match. |
|000033d0| 20 20 20 20 20 20 49 46 | 20 4e 4f 54 20 66 6f 75 | IF| NOT fou|
|000033e0| 6e 64 20 54 48 45 4e 0d | 20 20 20 20 20 20 20 20 |nd THEN.| |
|000033f0| 20 20 20 20 63 61 6c 6c | 20 5f 47 65 74 4e 61 6d | call| _GetNam|
|00003400| 65 64 52 65 73 6f 75 72 | 63 65 20 66 6f 72 20 64 |edResour|ce for d|
|00003410| 72 69 76 65 72 20 6e 61 | 6d 65 20 74 79 70 65 20 |river na|me type |
|00003420| 27 44 52 56 52 27 0d 20 | 20 20 20 20 20 20 20 49 |'DRVR'. | I|
|00003430| 46 20 4e 4f 54 20 73 75 | 63 63 65 73 73 66 75 6c |F NOT su|ccessful|
|00003440| 20 54 48 45 4e 0d 20 20 | 20 20 20 20 20 20 20 20 | THEN. | |
|00003450| 20 20 72 65 74 75 72 6e | 20 65 72 72 6f 72 0d 20 | return| error. |
|00003460| 20 20 20 20 20 20 20 7b | 66 6f 75 6e 64 20 64 72 | {|found dr|
|00003470| 69 76 65 72 7d 0d 20 20 | 20 20 20 20 20 20 67 65 |iver}. | ge|
|00003480| 74 20 72 65 73 6f 75 72 | 63 65 20 49 44 20 6f 66 |t resour|ce ID of|
|00003490| 20 27 44 52 56 52 27 20 | 72 65 73 6f 75 72 63 65 | 'DRVR' |resource|
|000034a0| 0d 20 20 20 20 20 20 20 | 20 49 46 20 75 6e 69 74 |. | IF unit|
|000034b0| 20 6e 75 6d 62 65 72 20 | 6e 6f 74 20 61 6c 72 65 | number |not alre|
|000034c0| 61 64 79 20 69 6e 20 75 | 73 65 20 54 48 45 4e 0d |ady in u|se THEN.|
|000034d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 69 6e 73 74 | | inst|
|000034e0| 61 6c 6c 20 64 72 69 76 | 65 72 20 5d 20 20 20 20 |all driv|er ] |
|000034f0| 7b 6f 74 68 65 72 77 69 | 73 65 2c 20 6c 65 61 76 |{otherwi|se, leav|
|00003500| 65 20 6f 6c 64 20 64 72 | 69 76 65 72 20 74 68 65 |e old dr|iver the|
|00003510| 72 65 7d 0d 20 20 20 20 | 49 46 20 64 72 69 76 65 |re}. |IF drive|
|00003520| 72 20 4e 4f 54 20 61 6c | 72 65 61 64 79 20 6f 70 |r NOT al|ready op|
|00003530| 65 6e 20 54 48 45 4e 20 | 5b 0d 20 20 20 20 20 20 |en THEN |[. |
|00003540| 20 20 6d 6f 76 65 20 44 | 72 76 72 20 66 69 65 6c | move D|rvr fiel|
|00003550| 64 73 20 69 6e 74 6f 20 | 63 6f 72 72 65 73 70 6f |ds into |correspo|
|00003560| 6e 64 69 6e 67 20 44 43 | 45 20 66 69 65 6c 64 73 |nding DC|E fields|
|00003570| 0d 20 20 20 20 20 20 20 | 20 49 46 20 64 72 69 76 |. | IF driv|
|00003580| 65 72 20 69 73 20 52 41 | 4d 2d 62 61 73 65 64 20 |er is RA|M-based |
|00003590| 54 48 45 4e 0d 20 20 20 | 20 20 20 20 20 20 20 20 |THEN. | |
|000035a0| 20 73 65 74 20 52 41 4d | 2d 62 61 73 65 64 20 66 | set RAM|-based f|
|000035b0| 6c 61 67 20 69 6e 20 64 | 43 74 6c 46 6c 61 67 73 |lag in d|CtlFlags|
|000035c0| 20 66 69 65 6c 64 20 6f | 66 20 44 43 45 0d 20 20 | field o|f DCE. |
|000035d0| 20 20 20 20 20 20 49 46 | 20 64 72 69 76 65 72 20 | IF| driver |
|000035e0| 69 73 20 66 6f 72 20 73 | 6c 6f 74 20 64 65 76 69 |is for s|lot devi|
|000035f0| 63 65 20 54 48 45 4e 0d | 20 20 20 20 20 20 20 20 |ce THEN.| |
|00003600| 20 20 20 20 63 61 6c 6c | 20 5f 53 46 69 6e 64 44 | call| _SFindD|
|00003610| 65 76 42 61 73 65 20 61 | 6e 64 20 70 75 74 20 72 |evBase a|nd put r|
|00003620| 65 73 75 6c 74 20 69 6e | 74 6f 20 44 43 45 20 5d |esult in|to DCE ]|
|00003630| 0d 20 20 20 20 49 46 20 | 64 72 69 76 65 72 20 6e |. IF |driver n|
|00003640| 65 65 64 73 4c 6f 63 6b | 20 54 48 45 4e 0d 20 20 |eedsLock| THEN. |
|00003650| 20 20 20 20 20 20 6c 6f | 63 6b 20 64 72 69 76 65 | lo|ck drive|
|00003660| 72 20 61 6e 64 20 44 43 | 45 0d 20 20 20 20 49 46 |r and DC|E. IF|
|00003670| 20 64 72 69 76 65 72 20 | 4e 4f 54 20 61 6c 72 65 | driver |NOT alre|
|00003680| 61 64 79 20 6f 70 65 6e | 20 4f 52 20 63 61 6c 6c |ady open| OR call|
|00003690| 65 64 20 66 72 6f 6d 20 | 5f 4f 70 65 6e 44 65 73 |ed from |_OpenDes|
|000036a0| 6b 41 63 63 20 54 48 45 | 4e 0d 20 20 20 20 20 20 |kAcc THE|N. |
|000036b0| 20 20 63 61 6c 6c 20 4f | 70 65 6e 20 72 6f 75 74 | call O|pen rout|
|000036c0| 69 6e 65 20 6f 66 20 64 | 72 69 76 65 72 0d 20 20 |ine of d|river. |
|000036d0| 20 20 49 46 20 61 6e 79 | 20 65 72 72 6f 72 20 72 | IF any| error r|
|000036e0| 65 73 75 6c 74 65 64 20 | 54 48 45 4e 20 5b 0d 20 |esulted |THEN [. |
|000036f0| 20 20 20 20 20 20 20 63 | 6c 65 61 72 20 69 6f 52 | c|lear ioR|
|00003700| 65 66 6e 75 6d 20 66 69 | 65 6c 64 0d 20 20 20 20 |efnum fi|eld. |
|00003710| 20 20 20 20 63 6c 65 61 | 72 20 64 72 69 76 65 72 | clea|r driver|
|00003720| 4f 70 65 6e 20 62 69 74 | 20 6f 66 20 64 43 74 6c |Open bit| of dCtl|
|00003730| 46 6c 61 67 73 0d 20 20 | 20 20 20 20 20 20 75 6e |Flags. | un|
|00003740| 6c 6f 63 6b 20 64 72 69 | 76 65 72 20 61 6e 64 20 |lock dri|ver and |
|00003750| 44 43 45 20 5d 0d 20 20 | 20 20 45 4c 53 45 0d 20 |DCE ]. | ELSE. |
|00003760| 20 20 20 20 20 20 20 75 | 6e 6c 6f 63 6b 20 64 72 | u|nlock dr|
|00003770| 69 76 65 72 20 61 6e 64 | 20 44 43 45 20 69 66 20 |iver and| DCE if |
|00003780| 61 6c 6c 6f 77 65 64 0d | 20 20 20 20 73 65 74 20 |allowed.| set |
|00003790| 69 6f 52 65 73 75 6c 74 | 20 66 69 65 6c 64 20 74 |ioResult| field t|
|000037a0| 6f 20 72 65 73 75 6c 74 | 20 5d 0d 46 69 72 73 74 |o result| ].First|
|000037b0| 2c 20 5f 4f 70 65 6e 20 | 63 68 65 63 6b 73 20 74 |, _Open |checks t|
|000037c0| 6f 20 73 65 65 20 69 66 | 20 74 68 65 20 63 61 6c |o see if| the cal|
|000037d0| 6c 20 69 73 20 66 72 6f | 6d 20 5f 4f 70 65 6e 44 |l is fro|m _OpenD|
|000037e0| 65 73 6b 41 63 63 2e 20 | 54 68 69 73 20 63 68 65 |eskAcc. |This che|
|000037f0| 63 6b 20 69 73 20 6d 61 | 64 65 20 62 79 20 6c 6f |ck is ma|de by lo|
|00003800| 6f 6b 69 6e 67 20 66 6f | 72 20 61 20 73 70 65 63 |oking fo|r a spec|
|00003810| 69 61 6c 20 76 61 6c 75 | 65 20 69 6e 20 74 68 65 |ial valu|e in the|
|00003820| 20 69 6f 46 69 6c 65 54 | 79 70 65 20 66 69 65 6c | ioFileT|ype fiel|
|00003830| 64 20 6f 66 20 74 68 65 | 20 70 61 72 61 6d 65 74 |d of the| paramet|
|00003840| 65 72 20 62 6c 6f 63 6b | 2c 20 77 68 69 63 68 20 |er block|, which |
|00003850| 5f 4f 70 65 6e 44 65 73 | 6b 41 63 63 20 73 65 74 |_OpenDes|kAcc set|
|00003860| 73 2e 20 54 68 65 20 66 | 69 6c 65 6e 61 6d 65 20 |s. The f|ilename |
|00003870| 73 68 6f 75 6c 64 20 61 | 6c 73 6f 20 62 65 67 69 |should a|lso begi|
|00003880| 6e 20 77 69 74 68 20 61 | 20 6e 75 6c 6c 20 62 79 |n with a| null by|
|00003890| 74 65 20 28 24 30 30 29 | 2c 20 62 75 74 20 74 68 |te ($00)|, but th|
|000038a0| 69 73 20 69 73 20 6e 6f | 74 20 63 68 65 63 6b 65 |is is no|t checke|
|000038b0| 64 2e 20 49 66 20 74 68 | 65 20 63 61 6c 6c 20 69 |d. If th|e call i|
|000038c0| 73 20 6e 6f 74 20 66 72 | 6f 6d 20 5f 4f 70 65 6e |s not fr|om _Open|
|000038d0| 44 65 73 6b 41 63 63 2c | 20 5f 4f 70 65 6e 20 63 |DeskAcc,| _Open c|
|000038e0| 68 65 63 6b 73 20 74 6f | 20 73 65 65 20 69 66 20 |hecks to| see if |
|000038f0| 74 68 65 20 66 69 6c 65 | 6e 61 6d 65 20 69 6e 20 |the file|name in |
|00003900| 74 68 65 20 70 61 72 61 | 6d 65 74 65 72 20 62 6c |the para|meter bl|
|00003910| 6f 63 6b 20 62 65 67 69 | 6e 73 20 77 69 74 68 20 |ock begi|ns with |
|00003920| 61 20 70 65 72 69 6f 64 | 20 28 2e 29 2e 20 49 66 |a period| (.). If|
|00003930| 20 74 68 65 20 66 69 6c | 65 6e 61 6d 65 20 64 6f | the fil|ename do|
|00003940| 65 73 20 6e 6f 74 20 62 | 65 67 69 6e 20 77 69 74 |es not b|egin wit|
|00003950| 68 20 61 20 70 65 72 69 | 6f 64 2c 20 63 6f 6e 74 |h a peri|od, cont|
|00003960| 72 6f 6c 20 69 73 20 70 | 61 73 73 65 64 20 74 6f |rol is p|assed to|
|00003970| 20 74 68 65 20 66 69 6c | 65 20 73 79 73 74 65 6d | the fil|e system|
|00003980| 2e 20 4f 74 68 65 72 77 | 69 73 65 2c 20 69 66 20 |. Otherw|ise, if |
|00003990| 74 68 65 20 6d 61 63 68 | 69 6e 65 20 69 73 20 61 |the mach|ine is a|
|000039a0| 20 4d 61 63 69 6e 74 6f | 73 68 20 77 69 74 68 20 | Macinto|sh with |
|000039b0| 74 68 65 20 53 6c 6f 74 | 20 4d 61 6e 61 67 65 72 |the Slot| Manager|
|000039c0| 2c 20 74 68 65 6e 20 61 | 20 63 68 65 63 6b 20 69 |, then a| check i|
|000039d0| 73 20 6d 61 64 65 20 74 | 6f 20 73 65 65 20 69 66 |s made t|o see if|
|000039e0| 20 74 68 65 20 64 72 69 | 76 65 72 20 69 73 20 66 | the dri|ver is f|
|000039f0| 6f 72 20 61 20 73 6c 6f | 74 20 64 65 76 69 63 65 |or a slo|t device|
|00003a00| 2e 20 49 66 20 62 69 74 | 20 39 20 6f 66 20 74 68 |. If bit| 9 of th|
|00003a10| 65 20 5f 4f 70 65 6e 20 | 74 72 61 70 20 77 6f 72 |e _Open |trap wor|
|00003a20| 64 20 69 73 20 73 65 74 | 20 61 6e 64 20 62 69 74 |d is set| and bit|
|00003a30| 20 30 20 6f 66 20 74 68 | 65 20 69 6f 46 6c 61 67 | 0 of th|e ioFlag|
|00003a40| 73 20 77 6f 72 64 20 69 | 73 20 73 65 74 20 6f 72 |s word i|s set or|
|00003a50| 20 74 68 65 20 69 6f 53 | 6c 6f 74 20 66 69 65 6c | the ioS|lot fiel|
|00003a60| 64 20 6f 66 20 74 68 65 | 20 70 61 72 61 6d 65 74 |d of the| paramet|
|00003a70| 65 72 20 62 6c 6f 63 6b | 20 69 73 20 6e 6f 74 20 |er block| is not |
|00003a80| 30 2c 20 74 68 65 6e 20 | 74 68 65 20 64 72 69 76 |0, then |the driv|
|00003a90| 65 72 20 69 73 20 61 73 | 73 75 6d 65 64 20 74 6f |er is as|sumed to|
|00003aa0| 20 62 65 20 66 6f 72 20 | 61 20 73 6c 6f 74 20 64 | be for |a slot d|
|00003ab0| 65 76 69 63 65 2e 0d 49 | 66 20 74 68 65 20 64 72 |evice..I|f the dr|
|00003ac0| 69 76 65 72 20 69 73 20 | 66 6f 72 20 61 20 73 6c |iver is |for a sl|
|00003ad0| 6f 74 20 64 65 76 69 63 | 65 2c 20 74 68 65 20 75 |ot devic|e, the u|
|00003ae0| 6e 69 74 20 74 61 62 6c | 65 20 69 73 20 73 65 61 |nit tabl|e is sea|
|00003af0| 72 63 68 65 64 2c 20 73 | 74 61 72 74 69 6e 67 20 |rched, s|tarting |
|00003b00| 61 74 20 75 6e 69 74 20 | 6e 75 6d 62 65 72 20 34 |at unit |number 4|
|00003b10| 38 20 61 6e 64 20 65 6e | 64 69 6e 67 20 61 74 20 |8 and en|ding at |
|00003b20| 55 6e 69 74 4e 74 72 79 | 43 6e 74 2e 20 49 66 20 |UnitNtry|Cnt. If |
|00003b30| 74 68 65 20 64 43 74 6c | 53 6c 6f 74 2c 20 64 43 |the dCtl|Slot, dC|
|00003b40| 74 6c 53 6c 6f 74 49 44 | 2c 20 61 6e 64 20 64 43 |tlSlotID|, and dC|
|00003b50| 74 6c 45 78 74 44 65 76 | 20 66 69 65 6c 64 73 20 |tlExtDev| fields |
|00003b60| 6f 66 20 6e 6f 6e 65 20 | 6f 66 20 74 68 65 20 44 |of none |of the D|
|00003b70| 43 45 73 20 6f 66 20 74 | 68 65 20 75 6e 69 74 20 |CEs of t|he unit |
|00003b80| 6e 75 6d 62 65 72 73 20 | 6d 61 74 63 68 20 74 68 |numbers |match th|
|00003b90| 65 20 66 69 65 6c 64 73 | 20 6f 66 20 74 68 65 20 |e fields| of the |
|00003ba0| 70 61 72 61 6d 65 74 65 | 72 20 62 6c 6f 63 6b 2c |paramete|r block,|
|00003bb0| 20 74 68 65 6e 20 5f 47 | 65 74 4e 61 6d 65 64 52 | then _G|etNamedR|
|00003bc0| 65 73 6f 75 72 63 65 20 | 69 73 20 63 61 6c 6c 65 |esource |is calle|
|00003bd0| 64 2c 20 75 73 69 6e 67 | 20 74 68 65 20 6e 61 6d |d, using| the nam|
|00003be0| 65 20 6f 66 20 74 68 65 | 20 64 72 69 76 65 72 20 |e of the| driver |
|00003bf0| 61 6e 64 20 74 79 70 65 | 20 27 44 52 56 52 27 2e |and type| 'DRVR'.|
|00003c00| 20 49 66 20 74 68 61 74 | 20 66 61 69 6c 73 2c 20 | If that| fails, |
|00003c10| 74 68 65 6e 20 5f 53 47 | 65 74 44 72 69 76 65 72 |then _SG|etDriver|
|00003c20| 20 69 73 20 63 61 6c 6c | 65 64 20 74 6f 20 6c 6f | is call|ed to lo|
|00003c30| 61 64 20 74 68 65 20 64 | 72 69 76 65 72 20 66 72 |ad the d|river fr|
|00003c40| 6f 6d 20 74 68 65 20 63 | 61 72 64 d5 73 20 52 4f |om the c|ard.s RO|
|00003c50| 4d 2e 20 49 66 20 74 68 | 61 74 20 61 74 74 65 6d |M. If th|at attem|
|00003c60| 70 74 20 66 61 69 6c 73 | 2c 20 61 6e 20 65 72 72 |pt fails|, an err|
|00003c70| 6f 72 20 69 73 20 72 65 | 70 6f 72 74 65 64 2e 20 |or is re|ported. |
|00003c80| 49 6e 20 74 68 65 20 63 | 61 73 65 20 77 68 65 72 |In the c|ase wher|
|00003c90| 65 20 6f 6e 65 20 6f 66 | 20 74 68 65 20 61 74 74 |e one of| the att|
|00003ca0| 65 6d 70 74 73 20 73 75 | 63 63 65 65 64 73 2c 20 |empts su|cceeds, |
|00003cb0| 74 68 65 20 75 6e 69 74 | 20 74 61 62 6c 65 20 69 |the unit| table i|
|00003cc0| 73 20 73 65 61 72 63 68 | 65 64 20 61 66 74 65 72 |s search|ed after|
|00003cd0| 20 6c 6f 61 64 69 6e 67 | 20 74 68 65 20 6e 65 77 | loading| the new|
|00003ce0| 20 64 72 69 76 65 72 2c | 20 73 74 61 72 74 69 6e | driver,| startin|
|00003cf0| 67 20 61 74 20 75 6e 69 | 74 20 6e 75 6d 62 65 72 |g at uni|t number|
|00003d00| 20 34 38 20 61 6e 64 20 | 65 6e 64 69 6e 67 20 61 | 48 and |ending a|
|00003d10| 74 20 55 6e 69 74 4e 74 | 72 79 43 6e 74 2c 20 66 |t UnitNt|ryCnt, f|
|00003d20| 6f 72 20 61 6e 20 75 6e | 75 73 65 64 20 28 4e 49 |or an un|used (NI|
|00003d30| 4c 29 20 73 6c 6f 74 2e | 20 49 66 20 6e 6f 6e 65 |L) slot.| If none|
|00003d40| 20 61 72 65 20 66 6f 75 | 6e 64 2c 20 74 68 65 20 | are fou|nd, the |
|00003d50| 76 61 6c 75 65 20 6f 66 | 20 55 6e 69 74 4e 74 72 |value of| UnitNtr|
|00003d60| 79 43 6e 74 20 69 73 20 | 69 6e 63 72 65 6d 65 6e |yCnt is |incremen|
|00003d70| 74 65 64 20 62 79 20 66 | 6f 75 72 2e 20 49 66 20 |ted by f|our. If |
|00003d80| 74 68 65 20 76 61 6c 75 | 65 20 65 78 63 65 65 64 |the valu|e exceed|
|00003d90| 73 20 31 32 38 2c 20 74 | 68 65 6e 20 61 6e 20 65 |s 128, t|hen an e|
|00003da0| 72 72 6f 72 20 69 73 20 | 72 65 70 6f 72 74 65 64 |rror is |reported|
|00003db0| 2e 20 4f 74 68 65 72 77 | 69 73 65 20 64 72 69 76 |. Otherw|ise driv|
|00003dc0| 65 72 20 75 73 65 73 20 | 74 68 65 20 6e 65 77 6c |er uses |the newl|
|00003dd0| 79 20 63 72 65 61 74 65 | 64 20 73 6c 6f 74 2e 0d |y create|d slot..|
|00003de0| 49 66 20 74 68 65 20 64 | 72 69 76 65 72 20 69 73 |If the d|river is|
|00003df0| 20 6e 6f 74 20 66 6f 72 | 20 61 20 73 6c 6f 74 20 | not for| a slot |
|00003e00| 64 65 76 69 63 65 20 6f | 72 20 68 61 73 20 62 65 |device o|r has be|
|00003e10| 65 6e 20 64 65 74 65 72 | 6d 69 6e 65 64 20 74 6f |en deter|mined to|
|00003e20| 20 62 65 20 61 20 64 65 | 73 6b 20 61 63 63 65 73 | be a de|sk acces|
|00003e30| 73 6f 72 79 2c 20 74 68 | 65 20 75 6e 69 74 20 74 |sory, th|e unit t|
|00003e40| 61 62 6c 65 20 69 73 20 | 73 65 61 72 63 68 65 64 |able is |searched|
|00003e50| 2c 20 73 74 61 72 74 69 | 6e 67 20 61 74 20 75 6e |, starti|ng at un|
|00003e60| 69 74 20 6e 75 6d 62 65 | 72 20 30 20 61 6e 64 20 |it numbe|r 0 and |
|00003e70| 65 6e 64 69 6e 67 20 61 | 74 20 55 6e 69 74 4e 74 |ending a|t UnitNt|
|00003e80| 72 79 43 6e 74 2e 20 49 | 66 20 6e 6f 6e 65 20 6f |ryCnt. I|f none o|
|00003e90| 66 20 74 68 65 20 6e 61 | 6d 65 73 20 66 6f 72 20 |f the na|mes for |
|00003ea0| 74 68 65 20 69 6e 73 74 | 61 6c 6c 65 64 20 64 72 |the inst|alled dr|
|00003eb0| 69 76 65 72 73 20 69 6e | 20 74 68 65 20 74 61 62 |ivers in| the tab|
|00003ec0| 6c 65 20 6d 61 74 63 68 | 65 73 20 74 68 65 20 66 |le match|es the f|
|00003ed0| 69 6c 65 6e 61 6d 65 20 | 6f 66 20 74 68 65 20 70 |ilename |of the p|
|00003ee0| 61 72 61 6d 65 74 65 72 | 20 62 6c 6f 63 6b 2c 20 |arameter| block, |
|00003ef0| 74 68 65 6e 20 5f 47 65 | 74 4e 61 6d 65 64 52 65 |then _Ge|tNamedRe|
|00003f00| 73 6f 75 72 63 65 20 69 | 73 20 63 61 6c 6c 65 64 |source i|s called|
|00003f10| 2c 20 75 73 69 6e 67 20 | 74 68 65 20 6e 61 6d 65 |, using |the name|
|00003f20| 20 6f 66 20 74 68 65 20 | 64 72 69 76 65 72 20 61 | of the |driver a|
|00003f30| 6e 64 20 74 79 70 65 20 | 27 44 52 56 52 27 2e 20 |nd type |'DRVR'. |
|00003f40| 49 66 20 74 68 61 74 20 | 61 74 74 65 6d 70 74 20 |If that |attempt |
|00003f50| 66 61 69 6c 73 2c 20 61 | 6e 20 65 72 72 6f 72 20 |fails, a|n error |
|00003f60| 69 73 20 72 65 70 6f 72 | 74 65 64 2e 20 49 66 20 |is repor|ted. If |
|00003f70| 74 68 65 20 61 74 74 65 | 6d 70 74 20 73 75 63 63 |the atte|mpt succ|
|00003f80| 65 65 64 73 2c 20 74 68 | 65 20 49 44 20 6f 66 20 |eeds, th|e ID of |
|00003f90| 74 68 65 20 72 65 73 6f | 75 72 63 65 20 69 73 20 |the reso|urce is |
|00003fa0| 61 73 73 75 6d 65 64 20 | 74 6f 20 62 65 20 74 68 |assumed |to be th|
|00003fb0| 65 20 75 6e 69 74 20 6e | 75 6d 62 65 72 20 6f 66 |e unit n|umber of|
|00003fc0| 20 74 68 65 20 64 72 69 | 76 65 72 20 61 6e 64 20 | the dri|ver and |
|00003fd0| 69 73 20 6d 61 70 70 65 | 64 20 69 6e 74 6f 20 74 |is mappe|d into t|
|00003fe0| 68 65 20 65 71 75 69 76 | 61 6c 65 6e 74 20 72 65 |he equiv|alent re|
|00003ff0| 66 6e 75 6d 2e 20 49 66 | 20 74 68 65 20 73 6c 6f |fnum. If| the slo|
|00004000| 74 20 66 6f 72 20 74 68 | 61 74 20 72 65 66 6e 75 |t for th|at refnu|
|00004010| 6d 20 69 73 20 61 6c 72 | 65 61 64 79 20 6f 63 63 |m is alr|eady occ|
|00004020| 75 70 69 65 64 2c 20 74 | 68 65 6e 20 74 68 65 20 |upied, t|hen the |
|00004030| 64 72 69 76 65 72 20 74 | 68 61 74 20 69 73 20 61 |driver t|hat is a|
|00004040| 6c 72 65 61 64 79 20 74 | 68 65 72 65 20 72 65 6d |lready t|here rem|
|00004050| 61 69 6e 73 20 74 68 65 | 72 65 2e 0d 4f 6e 63 65 |ains the|re..Once|
|00004060| 20 74 68 65 20 64 65 76 | 69 63 65 20 64 72 69 76 | the dev|ice driv|
|00004070| 65 72 20 69 73 20 69 6e | 73 74 61 6c 6c 65 64 2c |er is in|stalled,|
|00004080| 20 6f 72 20 69 74 20 68 | 61 73 20 62 65 65 6e 20 | or it h|as been |
|00004090| 64 65 74 65 72 6d 69 6e | 65 64 20 74 68 61 74 20 |determin|ed that |
|000040a0| 61 20 64 72 69 76 65 72 | 20 61 6c 72 65 61 64 79 |a driver| already|
|000040b0| 20 6f 63 63 75 70 69 65 | 73 20 74 68 65 20 73 6c | occupie|s the sl|
|000040c0| 6f 74 20 69 6e 20 74 68 | 65 20 75 6e 69 74 20 74 |ot in th|e unit t|
|000040d0| 61 62 6c 65 2c 20 74 68 | 65 20 64 72 69 76 65 72 |able, th|e driver|
|000040e0| 20 69 73 20 63 68 65 63 | 6b 65 64 20 74 6f 20 73 | is chec|ked to s|
|000040f0| 65 65 20 69 66 20 69 74 | 20 68 61 73 20 61 6c 72 |ee if it| has alr|
|00004100| 65 61 64 79 20 62 65 65 | 6e 20 6f 70 65 6e 65 64 |eady bee|n opened|
|00004110| 2e 20 49 66 20 69 74 20 | 68 61 73 20 6e 6f 74 2c |. If it |has not,|
|00004120| 20 74 68 65 20 64 72 69 | 76 65 72 20 69 73 20 63 | the dri|ver is c|
|00004130| 68 65 63 6b 65 64 20 74 | 6f 20 73 65 65 20 69 66 |hecked t|o see if|
|00004140| 20 69 74 20 69 73 20 52 | 41 4d 2d 62 61 73 65 64 | it is R|AM-based|
|00004150| 20 6f 72 20 61 6e 64 20 | 74 68 65 20 64 43 74 6c | or and |the dCtl|
|00004160| 46 6c 61 67 73 20 66 69 | 65 6c 64 20 6f 66 20 74 |Flags fi|eld of t|
|00004170| 68 65 20 64 72 69 76 65 | 72 d5 73 20 44 43 45 20 |he drive|r.s DCE |
|00004180| 69 73 20 73 65 74 20 61 | 63 63 6f 72 64 69 6e 67 |is set a|ccording|
|00004190| 6c 79 2c 20 61 6c 6f 6e | 67 20 77 69 74 68 20 62 |ly, alon|g with b|
|000041a0| 65 69 6e 67 20 63 6f 6d | 62 69 6e 65 64 20 77 69 |eing com|bined wi|
|000041b0| 74 68 20 74 68 65 20 72 | 65 73 74 20 6f 66 20 74 |th the r|est of t|
|000041c0| 68 65 20 44 72 76 72 46 | 6c 61 67 73 20 66 69 65 |he DrvrF|lags fie|
|000041d0| 6c 64 20 6f 66 20 74 68 | 65 20 64 72 69 76 65 72 |ld of th|e driver|
|000041e0| 20 68 65 61 64 65 72 2e | 20 54 68 65 20 44 72 76 | header.| The Drv|
|000041f0| 72 44 65 6c 61 79 2c 20 | 44 72 76 72 45 4d 61 73 |rDelay, |DrvrEMas|
|00004200| 6b 2c 20 61 6e 64 20 44 | 72 76 72 4d 65 6e 75 20 |k, and D|rvrMenu |
|00004210| 66 69 65 6c 64 73 20 66 | 72 6f 6d 20 74 68 65 20 |fields f|rom the |
|00004220| 64 72 69 76 65 72 20 68 | 65 61 64 65 72 20 61 72 |driver h|eader ar|
|00004230| 65 20 61 6c 73 6f 20 6d | 6f 76 65 64 20 69 6e 74 |e also m|oved int|
|00004240| 6f 20 74 68 65 20 63 6f | 72 72 65 73 70 6f 6e 64 |o the co|rrespond|
|00004250| 69 6e 67 20 66 69 65 6c | 64 73 20 6f 66 20 74 68 |ing fiel|ds of th|
|00004260| 65 20 44 43 45 2e 20 49 | 66 20 74 68 65 20 64 72 |e DCE. I|f the dr|
|00004270| 69 76 65 72 20 69 73 20 | 66 6f 72 20 61 20 73 6c |iver is |for a sl|
|00004280| 6f 74 20 64 65 76 69 63 | 65 2c 20 5f 53 46 69 6e |ot devic|e, _SFin|
|00004290| 64 44 65 76 42 61 73 65 | 20 69 73 20 63 61 6c 6c |dDevBase| is call|
|000042a0| 65 64 20 66 6f 72 20 74 | 68 65 20 73 6c 6f 74 20 |ed for t|he slot |
|000042b0| 61 6e 64 20 49 44 20 6f | 66 20 74 68 65 20 64 72 |and ID o|f the dr|
|000042c0| 69 76 65 72 d5 73 20 64 | 65 76 69 63 65 20 61 6e |iver.s d|evice an|
|000042d0| 64 20 74 68 65 20 72 65 | 73 75 6c 74 20 69 73 20 |d the re|sult is |
|000042e0| 70 75 74 20 69 6e 74 6f | 20 74 68 65 20 44 43 45 |put into| the DCE|
|000042f0| 2e 0d 4f 6e 63 65 20 74 | 68 65 20 44 43 45 20 66 |..Once t|he DCE f|
|00004300| 69 65 6c 64 73 20 68 61 | 76 65 20 62 65 65 6e 20 |ields ha|ve been |
|00004310| 63 6f 6d 70 6c 65 74 65 | 64 2c 20 6f 72 20 69 74 |complete|d, or it|
|00004320| 20 69 73 20 64 65 74 65 | 72 6d 69 6e 65 64 20 74 | is dete|rmined t|
|00004330| 68 61 74 20 74 68 65 20 | 64 72 69 76 65 72 20 69 |hat the |driver i|
|00004340| 73 20 61 6c 72 65 61 64 | 79 20 6f 70 65 6e 2c 20 |s alread|y open, |
|00004350| 74 68 65 20 64 72 69 76 | 65 72 20 61 6e 64 20 44 |the driv|er and D|
|00004360| 43 45 20 61 72 65 20 6c | 6f 63 6b 65 64 20 69 66 |CE are l|ocked if|
|00004370| 20 6e 65 65 64 65 64 2e | 20 54 68 65 20 70 65 72 | needed.| The per|
|00004380| 6d 69 73 73 69 6f 6e 73 | 20 61 72 65 20 74 68 65 |missions| are the|
|00004390| 6e 20 63 68 65 63 6b 65 | 64 2c 20 72 65 74 75 72 |n checke|d, retur|
|000043a0| 6e 69 6e 67 20 61 6e 20 | 65 72 72 6f 72 20 69 66 |ning an |error if|
|000043b0| 20 69 6e 63 6f 72 72 65 | 63 74 2c 20 61 6e 64 20 | incorre|ct, and |
|000043c0| 74 68 65 20 4f 70 65 6e | 20 72 6f 75 74 69 6e 65 |the Open| routine|
|000043d0| 20 6f 66 20 74 68 65 20 | 64 72 69 76 65 72 20 69 | of the |driver i|
|000043e0| 73 20 63 61 6c 6c 65 64 | 20 69 66 20 74 68 65 20 |s called| if the |
|000043f0| 64 72 69 76 65 72 20 69 | 73 20 6e 6f 74 20 61 6c |driver i|s not al|
|00004400| 72 65 61 64 79 20 6f 70 | 65 6e 20 6f 72 20 69 66 |ready op|en or if|
|00004410| 20 74 68 65 20 63 61 6c | 6c 20 77 61 73 20 66 72 | the cal|l was fr|
|00004420| 6f 6d 20 5f 4f 70 65 6e | 44 65 73 6b 41 63 63 2e |om _Open|DeskAcc.|
|00004430| 20 49 66 20 74 68 65 20 | 64 72 69 76 65 72 20 72 | If the |driver r|
|00004440| 65 74 75 72 6e 73 20 61 | 6e 79 20 65 72 72 6f 72 |eturns a|ny error|
|00004450| 2c 20 74 68 65 6e 20 74 | 68 65 20 69 6f 52 65 73 |, then t|he ioRes|
|00004460| 75 6c 74 20 66 69 65 6c | 64 20 6f 66 20 74 68 65 |ult fiel|d of the|
|00004470| 20 70 61 72 61 6d 65 74 | 65 72 20 62 6c 6f 63 6b | paramet|er block|
|00004480| 20 61 6e 64 20 74 68 65 | 20 64 72 69 76 65 72 4f | and the| driverO|
|00004490| 70 65 6e 20 62 69 74 20 | 6f 66 20 74 68 65 20 64 |pen bit |of the d|
|000044a0| 43 74 6c 46 6c 61 67 73 | 20 66 69 65 6c 64 20 61 |CtlFlags| field a|
|000044b0| 72 65 20 63 6c 65 61 72 | 65 64 2c 20 61 6e 64 20 |re clear|ed, and |
|000044c0| 74 68 65 20 64 72 69 76 | 65 72 20 61 6e 64 20 69 |the driv|er and i|
|000044d0| 74 73 20 44 43 45 20 61 | 72 65 20 75 6e 6c 6f 63 |ts DCE a|re unloc|
|000044e0| 6b 65 64 2e 20 49 66 20 | 74 68 65 20 64 72 69 76 |ked. If |the driv|
|000044f0| 65 72 20 72 65 74 75 72 | 6e 73 20 6e 6f 20 65 72 |er retur|ns no er|
|00004500| 72 6f 72 73 2c 20 74 68 | 65 6e 20 69 74 20 61 6e |rors, th|en it an|
|00004510| 64 20 74 68 65 20 44 43 | 45 20 61 72 65 20 75 6e |d the DC|E are un|
|00004520| 6c 6f 63 6b 65 64 2c 20 | 69 66 20 61 6c 6c 6f 77 |locked, |if allow|
|00004530| 65 64 2e 20 49 6e 20 65 | 69 74 68 65 72 20 63 61 |ed. In e|ither ca|
|00004540| 73 65 2c 20 74 68 65 20 | 72 65 73 75 6c 74 20 66 |se, the |result f|
|00004550| 72 6f 6d 20 74 68 65 20 | 64 72 69 76 65 72 d5 73 |rom the |driver.s|
|00004560| 20 4f 70 65 6e 20 72 6f | 75 74 69 6e 65 20 69 73 | Open ro|utine is|
|00004570| 20 70 75 74 20 69 6e 20 | 74 68 65 20 69 6f 52 65 | put in |the ioRe|
|00004580| 73 75 6c 74 20 66 69 65 | 6c 64 20 6f 66 20 74 68 |sult fie|ld of th|
|00004590| 65 20 70 61 72 61 6d 65 | 74 65 72 20 62 6c 6f 63 |e parame|ter bloc|
|000045a0| 6b 2e 0d 54 68 61 74 d5 | 73 20 47 72 65 61 74 2c |k..That.|s Great,|
|000045b0| 20 42 75 74 20 57 68 61 | 74 20 41 72 65 20 59 6f | But Wha|t Are Yo|
|000045c0| 75 20 44 72 69 76 69 6e | 67 20 41 74 3f 0d 53 6f |u Drivin|g At?.So|
|000045d0| 2c 20 6f 66 20 77 68 61 | 74 20 70 72 61 63 74 69 |, of wha|t practi|
|000045e0| 63 61 6c 20 76 61 6c 75 | 65 20 69 73 20 61 6c 6c |cal valu|e is all|
|000045f0| 20 74 68 69 73 3f 20 49 | 66 20 79 6f 75 20 61 72 | this? I|f you ar|
|00004600| 65 20 74 72 79 69 6e 67 | 20 74 6f 20 70 72 6f 76 |e trying| to prov|
|00004610| 69 64 65 20 61 20 6e 6f | 6e 73 6c 6f 74 20 64 72 |ide a no|nslot dr|
|00004620| 69 76 65 72 20 74 68 61 | 74 20 63 61 6e 20 62 65 |iver tha|t can be|
|00004630| 20 69 6e 73 74 61 6c 6c | 65 64 20 61 74 20 49 4e | install|ed at IN|
|00004640| 49 54 20 74 69 6d 65 20 | 61 6e 64 20 75 73 65 64 |IT time |and used|
|00004650| 20 6c 61 74 65 72 20 62 | 79 20 6f 74 68 65 72 20 | later b|y other |
|00004660| 73 6f 66 74 77 61 72 65 | 2c 20 74 68 65 20 62 65 |software|, the be|
|00004670| 73 74 20 6d 65 74 68 6f | 64 20 66 6f 72 20 66 69 |st metho|d for fi|
|00004680| 6e 64 69 6e 67 20 61 20 | 75 6e 69 74 20 6e 75 6d |nding a |unit num|
|00004690| 62 65 72 20 69 6e 20 74 | 68 65 20 75 6e 69 74 20 |ber in t|he unit |
|000046a0| 74 61 62 6c 65 20 69 73 | 20 74 68 65 20 77 61 79 |table is| the way|
|000046b0| 20 74 68 65 20 5f 4f 70 | 65 6e 20 74 72 61 70 20 | the _Op|en trap |
|000046c0| 6f 6e 20 74 68 65 20 4d | 61 63 69 6e 74 6f 73 68 |on the M|acintosh|
|000046d0| 20 49 49 20 66 61 6d 69 | 6c 79 20 66 69 6e 64 73 | II fami|ly finds|
|000046e0| 20 61 20 75 6e 69 74 20 | 6e 75 6d 62 65 72 20 69 | a unit |number i|
|000046f0| 6e 20 74 68 65 20 75 6e | 69 74 20 74 61 62 6c 65 |n the un|it table|
|00004700| 20 66 6f 72 20 73 6c 6f | 74 20 64 65 76 69 63 65 | for slo|t device|
|00004710| 20 64 72 69 76 65 72 73 | 2e 20 55 6e 66 6f 72 74 | drivers|. Unfort|
|00004720| 75 6e 61 74 65 6c 79 2c | 20 79 6f 75 20 6d 61 79 |unately,| you may|
|00004730| 20 77 61 6e 74 20 74 6f | 20 72 75 6e 20 6f 6e 20 | want to| run on |
|00004740| 6f 74 68 65 72 20 4d 61 | 63 69 6e 74 6f 73 68 20 |other Ma|cintosh |
|00004750| 6d 6f 64 65 6c 73 2c 20 | 61 6e 64 20 69 74 20 77 |models, |and it w|
|00004760| 6f 75 6c 64 20 62 65 20 | 61 20 62 69 74 20 6b 6c |ould be |a bit kl|
|00004770| 75 64 67 79 20 74 6f 20 | 66 61 6b 65 20 62 65 69 |udgy to |fake bei|
|00004780| 6e 67 20 61 20 73 6c 6f | 74 20 64 65 76 69 63 65 |ng a slo|t device|
|00004790| 20 64 72 69 76 65 72 2c | 20 73 6f 20 79 6f 75 20 | driver,| so you |
|000047a0| 63 61 6e 6e 6f 74 20 6a | 75 73 74 20 63 61 6c 6c |cannot j|ust call|
|000047b0| 20 5f 4f 70 65 6e 20 61 | 6e 64 20 70 72 65 74 65 | _Open a|nd prete|
|000047c0| 6e 64 20 74 6f 20 62 65 | 20 61 20 73 6c 6f 74 20 |nd to be| a slot |
|000047d0| 64 65 76 69 63 65 20 64 | 72 69 76 65 72 2e 20 41 |device d|river. A|
|000047e0| 64 64 69 74 69 6f 6e 61 | 6c 6c 79 2c 20 69 74 20 |dditiona|lly, it |
|000047f0| 69 73 20 6c 69 6b 65 6c | 79 20 74 68 61 74 20 79 |is likel|y that y|
|00004800| 6f 75 20 6d 61 79 20 77 | 69 73 68 20 74 68 61 74 |ou may w|ish that|
|00004810| 20 74 68 65 20 64 72 69 | 76 65 72 d5 73 20 4f 70 | the dri|ver.s Op|
|00004820| 65 6e 20 72 6f 75 74 69 | 6e 65 20 6e 6f 74 20 62 |en routi|ne not b|
|00004830| 65 20 63 61 6c 6c 65 64 | 20 75 6e 74 69 6c 20 69 |e called| until i|
|00004840| 74 20 69 73 20 61 63 74 | 75 61 6c 6c 79 20 6f 70 |t is act|ually op|
|00004850| 65 6e 65 64 20 77 69 74 | 68 20 74 68 65 20 5f 4f |ened wit|h the _O|
|00004860| 70 65 6e 20 74 72 61 70 | 20 62 79 20 73 6f 66 74 |pen trap| by soft|
|00004870| 77 61 72 65 20 74 68 61 | 74 20 72 65 61 6c 6c 79 |ware tha|t really|
|00004880| 20 77 61 6e 74 73 20 74 | 6f 20 75 73 65 20 69 74 | wants t|o use it|
|00004890| 3b 20 74 68 65 72 65 66 | 6f 72 65 2c 20 79 6f 75 |; theref|ore, you|
|000048a0| 72 20 49 4e 49 54 20 63 | 6f 64 65 20 6d 75 73 74 |r INIT c|ode must|
|000048b0| 20 6d 69 6d 69 63 20 74 | 68 65 20 70 65 72 74 69 | mimic t|he perti|
|000048c0| 6e 65 6e 74 20 63 6f 64 | 65 20 6f 66 20 74 68 65 |nent cod|e of the|
|000048d0| 20 5f 4f 70 65 6e 20 74 | 72 61 70 2e 0d 54 68 65 | _Open t|rap..The|
|000048e0| 20 66 69 72 73 74 20 61 | 63 74 69 6f 6e 20 73 68 | first a|ction sh|
|000048f0| 6f 75 6c 64 20 62 65 20 | 74 6f 20 63 61 6c 6c 20 |ould be |to call |
|00004900| 5f 47 65 74 4e 61 6d 65 | 64 52 65 73 6f 75 72 63 |_GetName|dResourc|
|00004910| 65 20 77 69 74 68 20 74 | 68 65 20 6e 61 6d 65 20 |e with t|he name |
|00004920| 6f 66 20 74 68 65 20 64 | 72 69 76 65 72 20 61 6e |of the d|river an|
|00004930| 64 20 69 74 73 20 72 65 | 73 6f 75 72 63 65 20 74 |d its re|source t|
|00004940| 79 70 65 20 28 74 79 70 | 69 63 61 6c 6c 79 20 27 |ype (typ|ically '|
|00004950| 44 52 56 52 27 2c 20 61 | 6c 74 68 6f 75 67 68 20 |DRVR', a|lthough |
|00004960| 69 74 20 69 73 20 6e 6f | 74 20 72 65 71 75 69 72 |it is no|t requir|
|00004970| 65 64 2c 20 73 69 6e 63 | 65 20 79 6f 75 20 61 72 |ed, sinc|e you ar|
|00004980| 65 20 6c 6f 61 64 69 6e | 67 20 69 74 29 2e 20 54 |e loadin|g it). T|
|00004990| 68 65 20 72 65 73 6f 75 | 72 63 65 20 74 68 61 74 |he resou|rce that|
|000049a0| 20 63 6f 6e 74 61 69 6e | 73 20 79 6f 75 72 20 64 | contain|s your d|
|000049b0| 72 69 76 65 72 20 6d 75 | 73 74 20 68 61 76 65 20 |river mu|st have |
|000049c0| 74 68 65 20 73 79 73 74 | 65 6d 20 68 65 61 70 20 |the syst|em heap |
|000049d0| 62 69 74 20 73 65 74 20 | 69 6e 20 69 74 73 20 72 |bit set |in its r|
|000049e0| 65 73 6f 75 72 63 65 20 | 61 74 74 72 69 62 75 74 |esource |attribut|
|000049f0| 65 73 2c 20 73 6f 20 69 | 74 20 69 73 20 6c 6f 61 |es, so i|t is loa|
|00004a00| 64 65 64 20 69 6e 74 6f | 20 74 68 65 20 73 79 73 |ded into| the sys|
|00004a10| 74 65 6d 20 68 65 61 70 | 20 77 68 65 72 65 20 69 |tem heap| where i|
|00004a20| 74 20 63 61 6e 20 63 6f | 6e 74 69 6e 75 65 20 74 |t can co|ntinue t|
|00004a30| 6f 20 65 78 69 73 74 2c | 20 6c 6f 6e 67 20 61 66 |o exist,| long af|
|00004a40| 74 65 72 20 74 68 65 20 | 49 4e 49 54 20 68 61 73 |ter the |INIT has|
|00004a50| 20 67 6f 6e 65 20 61 77 | 61 79 2e 20 4e 6f 74 65 | gone aw|ay. Note|
|00004a60| 20 74 68 61 74 20 69 66 | 20 66 6f 72 20 73 6f 6d | that if| for som|
|00004a70| 65 20 69 6e 63 72 65 64 | 69 62 6c 65 20 72 65 61 |e incred|ible rea|
|00004a80| 73 6f 6e 2c 20 79 6f 75 | 72 20 64 72 69 76 65 72 |son, you|r driver|
|00004a90| 20 69 73 20 67 72 65 61 | 74 65 72 20 74 68 61 6e | is grea|ter than|
|00004aa0| 20 31 36 4b 2c 20 79 6f | 75 20 6d 69 67 68 74 20 | 16K, yo|u might |
|00004ab0| 77 61 6e 74 20 74 6f 20 | 69 6e 63 6c 75 64 65 20 |want to |include |
|00004ac0| 61 20 27 73 79 73 7a 27 | 20 72 65 73 6f 75 72 63 |a 'sysz'| resourc|
|00004ad0| 65 20 74 6f 20 69 6e 63 | 72 65 61 73 65 20 74 68 |e to inc|rease th|
|00004ae0| 65 20 61 76 61 69 6c 61 | 62 6c 65 20 73 70 61 63 |e availa|ble spac|
|00004af0| 65 20 69 6e 20 74 68 65 | 20 73 79 73 74 65 6d 20 |e in the| system |
|00004b00| 68 65 61 70 2e 0d 4e 65 | 78 74 2c 20 79 6f 75 20 |heap..Ne|xt, you |
|00004b10| 6d 75 73 74 20 63 61 6c | 6c 20 5f 44 65 74 61 63 |must cal|l _Detac|
|00004b20| 68 52 65 73 6f 75 72 63 | 65 20 77 69 74 68 20 74 |hResourc|e with t|
|00004b30| 68 65 20 68 61 6e 64 6c | 65 20 74 6f 20 79 6f 75 |he handl|e to you|
|00004b40| 72 20 72 65 73 6f 75 72 | 63 65 2c 20 73 6f 20 69 |r resour|ce, so i|
|00004b50| 74 20 69 73 20 6e 6f 74 | 20 72 65 6d 6f 76 65 64 |t is not| removed|
|00004b60| 20 77 68 65 6e 20 79 6f | 75 72 20 49 4e 49 54 20 | when yo|ur INIT |
|00004b70| 66 69 6c 65 20 69 73 20 | 63 6c 6f 73 65 64 2e 20 |file is |closed. |
|00004b80| 4e 6f 77 20 79 6f 75 20 | 61 72 65 20 72 65 61 64 |Now you |are read|
|00004b90| 79 20 74 6f 20 66 69 6e | 64 20 61 20 73 6c 6f 74 |y to fin|d a slot|
|00004ba0| 20 69 6e 20 74 68 65 20 | 75 6e 69 74 20 74 61 62 | in the |unit tab|
|00004bb0| 6c 65 20 66 6f 72 20 79 | 6f 75 72 20 64 72 69 76 |le for y|our driv|
|00004bc0| 65 72 2e 20 46 69 72 73 | 74 20 63 68 65 63 6b 20 |er. Firs|t check |
|00004bd0| 69 66 20 75 6e 69 74 20 | 6e 75 6d 62 65 72 73 20 |if unit |numbers |
|00004be0| 34 38 20 61 6e 64 20 68 | 69 67 68 65 72 20 61 72 |48 and h|igher ar|
|00004bf0| 65 20 65 76 65 6e 20 61 | 76 61 69 6c 61 62 6c 65 |e even a|vailable|
|00004c00| 20 62 79 20 63 68 65 63 | 6b 69 6e 67 20 55 6e 69 | by chec|king Uni|
|00004c10| 74 4e 74 72 79 43 6e 74 | 2e 0d 49 66 20 55 6e 69 |tNtryCnt|..If Uni|
|00004c20| 74 4e 74 72 79 43 6e 74 | 20 69 73 20 34 38 2c 20 |tNtryCnt| is 48, |
|00004c30| 79 6f 75 20 68 61 76 65 | 20 61 20 62 69 74 20 6f |you have| a bit o|
|00004c40| 66 20 61 20 70 72 6f 62 | 6c 65 6d 20 69 6e 20 74 |f a prob|lem in t|
|00004c50| 68 61 74 20 74 68 65 72 | 65 20 61 72 65 20 6e 6f |hat ther|e are no|
|00004c60| 20 65 6d 70 74 79 20 73 | 6c 6f 74 73 20 61 76 61 | empty s|lots ava|
|00004c70| 69 6c 61 62 6c 65 20 69 | 6e 20 74 68 65 20 75 6e |ilable i|n the un|
|00004c80| 69 74 20 74 61 62 6c 65 | 2e 20 59 6f 75 20 63 61 |it table|. You ca|
|00004c90| 6e 20 72 65 63 74 69 66 | 79 20 74 68 69 73 2c 20 |n rectif|y this, |
|00004ca0| 68 6f 77 65 76 65 72 2c | 20 62 79 20 72 65 73 69 |however,| by resi|
|00004cb0| 7a 69 6e 67 20 74 68 65 | 20 75 6e 69 74 20 74 61 |zing the| unit ta|
|00004cc0| 62 6c 65 2e 20 44 54 53 | 20 72 65 63 6f 6d 6d 65 |ble. DTS| recomme|
|00004cd0| 6e 64 73 20 79 6f 75 20 | 61 63 63 6f 6d 70 6c 69 |nds you |accompli|
|00004ce0| 73 68 20 74 68 61 74 20 | 74 61 73 6b 20 62 79 20 |sh that |task by |
|00004cf0| 63 72 65 61 74 69 6e 67 | 20 61 20 6e 65 77 20 75 |creating| a new u|
|00004d00| 6e 69 74 20 74 61 62 6c | 65 20 74 68 61 74 20 69 |nit tabl|e that i|
|00004d10| 73 20 6c 61 72 67 65 72 | 20 74 68 61 6e 20 74 68 |s larger| than th|
|00004d20| 65 20 6f 6c 64 20 6f 6e | 65 2e 0d 54 6f 20 72 65 |e old on|e..To re|
|00004d30| 73 69 7a 65 20 74 68 65 | 20 75 6e 69 74 20 74 61 |size the| unit ta|
|00004d40| 62 6c 65 2c 20 66 69 72 | 73 74 20 63 72 65 61 74 |ble, fir|st creat|
|00004d50| 65 20 61 20 6e 65 77 2c | 20 6e 6f 6e 72 65 6c 6f |e a new,| nonrelo|
|00004d60| 63 61 74 61 62 6c 65 20 | 62 6c 6f 63 6b 20 69 6e |catable |block in|
|00004d70| 20 74 68 65 20 73 79 73 | 74 65 6d 20 68 65 61 70 | the sys|tem heap|
|00004d80| 20 74 68 61 74 20 69 73 | 20 74 68 65 20 6e 65 77 | that is| the new|
|00004d90| 20 73 69 7a 65 20 79 6f | 75 20 77 61 6e 74 2c 20 | size yo|u want, |
|00004da0| 61 6e 64 20 63 6c 65 61 | 72 20 69 74 20 74 6f 20 |and clea|r it to |
|00004db0| 7a 65 72 6f 73 2e 20 54 | 68 65 20 66 6f 6c 6c 6f |zeros. T|he follo|
|00004dc0| 77 69 6e 67 20 61 73 73 | 65 6d 62 6c 79 2d 6c 61 |wing ass|embly-la|
|00004dd0| 6e 67 75 61 67 65 20 63 | 6f 64 65 20 66 72 61 67 |nguage c|ode frag|
|00004de0| 6d 65 6e 74 20 67 69 76 | 65 73 20 61 6e 20 65 78 |ment giv|es an ex|
|00004df0| 61 6d 70 6c 65 3a 0d 20 | 20 20 20 4d 4f 56 45 2e |ample:. | MOVE.|
|00004e00| 57 20 20 20 20 20 44 31 | 2c 44 30 20 20 20 20 20 |W D1|,D0 |
|00004e10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 3b | | ;|
|00004e20| 44 31 20 3d 20 72 65 71 | 75 65 73 74 65 64 20 23 |D1 = req|uested #|
|00004e30| 20 73 6c 6f 74 73 0d 20 | 20 20 20 4d 55 4c 55 2e | slots. | MULU.|
|00004e40| 57 20 20 20 20 20 23 34 | 2c 44 30 20 20 20 20 20 |W #4|,D0 |
|00004e50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 3b | | ;|
|00004e60| 74 75 72 6e 20 69 74 20 | 69 6e 74 6f 20 73 69 7a |turn it |into siz|
|00004e70| 65 0d 20 20 20 20 5f 4e | 65 77 50 74 72 2c 53 59 |e. _N|ewPtr,SY|
|00004e80| 53 2c 43 4c 45 41 52 20 | 20 20 20 20 20 20 20 20 |S,CLEAR | |
|00004e90| 20 20 20 20 20 20 20 20 | 20 20 3b 63 72 65 61 74 | | ;creat|
|00004ea0| 65 20 63 6c 65 61 72 20 | 62 6c 6f 63 6b 20 69 6e |e clear |block in|
|00004eb0| 20 73 79 73 74 65 6d 20 | 68 65 61 70 0d 20 20 20 | system |heap. |
|00004ec0| 20 42 4e 45 20 20 20 20 | 20 20 20 20 45 72 72 6f | BNE | Erro|
|00004ed0| 72 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |r | |
|00004ee0| 20 20 20 20 20 3b 63 68 | 65 63 6b 20 66 6f 72 20 | ;ch|eck for |
|00004ef0| 65 72 72 6f 72 73 21 0d | 4e 65 78 74 2c 20 79 6f |errors!.|Next, yo|
|00004f00| 75 20 6d 75 73 74 20 63 | 6f 70 79 20 74 68 65 20 |u must c|opy the |
|00004f10| 63 6f 6e 74 65 6e 74 73 | 20 6f 66 20 74 68 65 20 |contents| of the |
|00004f20| 6f 6c 64 20 75 6e 69 74 | 20 74 61 62 6c 65 20 69 |old unit| table i|
|00004f30| 6e 74 6f 20 74 68 65 20 | 6e 65 77 20 75 6e 69 74 |nto the |new unit|
|00004f40| 20 74 61 62 6c 65 2c 20 | 70 6f 69 6e 74 20 55 54 | table, |point UT|
|00004f50| 61 62 6c 65 42 61 73 65 | 20 74 6f 20 74 68 65 20 |ableBase| to the |
|00004f60| 6e 65 77 20 75 6e 69 74 | 20 74 61 62 6c 65 2c 20 |new unit| table, |
|00004f70| 61 6e 64 20 61 64 6a 75 | 73 74 20 74 68 65 20 76 |and adju|st the v|
|00004f80| 61 6c 75 65 20 6f 66 20 | 55 6e 69 74 4e 74 72 79 |alue of |UnitNtry|
|00004f90| 43 6e 74 2e 20 57 68 69 | 6c 65 20 64 6f 69 6e 67 |Cnt. Whi|le doing|
|00004fa0| 20 61 6c 6c 20 6f 66 20 | 74 68 61 74 2c 20 69 74 | all of |that, it|
|00004fb0| 20 77 6f 75 6c 64 20 62 | 65 20 6d 6f 73 74 20 69 | would b|e most i|
|00004fc0| 6e 63 6f 6e 76 65 6e 69 | 65 6e 74 20 69 66 20 61 |nconveni|ent if a|
|00004fd0| 6e 20 69 6e 74 65 72 72 | 75 70 74 20 6f 63 63 75 |n interr|upt occu|
|00004fe0| 72 72 65 64 3b 20 74 68 | 65 72 65 66 6f 72 65 2c |rred; th|erefore,|
|00004ff0| 20 79 6f 75 20 6d 75 73 | 74 20 74 75 72 6e 20 6f | you mus|t turn o|
|00005000| 66 66 20 69 6e 74 65 72 | 72 75 70 74 73 20 64 75 |ff inter|rupts du|
|00005010| 72 69 6e 67 20 74 68 65 | 20 70 72 6f 63 65 73 73 |ring the| process|
|00005020| 2e 20 54 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |. The fo|llowing |
|00005030| 61 73 73 65 6d 62 6c 79 | 2d 6c 61 6e 67 75 61 67 |assembly|-languag|
|00005040| 65 20 63 6f 64 65 20 66 | 72 61 67 6d 65 6e 74 2c |e code f|ragment,|
|00005050| 20 77 68 69 63 68 20 77 | 6f 75 6c 64 20 66 6f 6c | which w|ould fol|
|00005060| 6c 6f 77 20 74 68 65 20 | 70 72 65 76 69 6f 75 73 |low the |previous|
|00005070| 20 63 6f 64 65 2c 20 67 | 69 76 65 73 20 61 6e 20 | code, g|ives an |
|00005080| 65 78 61 6d 70 6c 65 3a | 0d 20 20 20 20 4d 4f 56 |example:|. MOV|
|00005090| 45 20 20 20 20 20 20 20 | 53 52 2c 2d 28 53 50 29 |E |SR,-(SP)|
|000050a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000050b0| 20 3b 73 61 76 65 20 6f | 6c 64 20 69 6e 74 65 72 | ;save o|ld inter|
|000050c0| 72 75 70 74 20 73 74 61 | 74 75 73 0d 20 20 20 20 |rupt sta|tus. |
|000050d0| 4f 52 09 20 20 20 20 20 | 20 20 23 30 37 30 30 2c |OR. | #0700,|
|000050e0| 53 52 09 20 20 20 20 20 | 20 20 20 20 20 20 3b 64 |SR. | ;d|
|000050f0| 69 73 61 62 6c 65 20 61 | 6c 6c 20 6d 61 73 6b 61 |isable a|ll maska|
|00005100| 62 6c 65 20 69 6e 74 65 | 72 72 75 70 74 73 0d 20 |ble inte|rrupts. |
|00005110| 20 20 20 4d 4f 56 45 41 | 2e 4c 20 20 20 20 41 30 | MOVEA|.L A0|
|00005120| 2c 41 31 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |,A1 | |
|00005130| 20 20 20 20 20 20 20 3b | 41 30 20 28 61 64 64 72 | ;|A0 (addr|
|00005140| 65 73 73 20 6e 65 77 20 | 75 6e 69 74 20 74 61 62 |ess new |unit tab|
|00005150| 6c 65 29 20 2d 3e 20 41 | 31 0d 20 20 20 20 4d 4f |le) -> A|1. MO|
|00005160| 56 45 41 2e 4c 20 20 20 | 20 55 54 61 62 6c 65 42 |VEA.L | UTableB|
|00005170| 61 73 65 2c 41 30 20 20 | 20 20 20 20 20 20 20 20 |ase,A0 | |
|00005180| 20 20 3b 6f 6c 64 20 75 | 6e 69 74 20 74 61 62 6c | ;old u|nit tabl|
|00005190| 65 20 2d 3e 20 41 30 0d | 20 20 20 20 4d 4f 56 45 |e -> A0.| MOVE|
|000051a0| 2e 57 20 20 20 20 20 55 | 6e 69 74 4e 74 72 79 43 |.W U|nitNtryC|
|000051b0| 6e 74 2c 44 30 20 20 20 | 20 20 20 20 20 20 20 20 |nt,D0 | |
|000051c0| 3b 6e 75 6d 62 65 72 20 | 6f 66 20 65 6e 74 72 69 |;number |of entri|
|000051d0| 65 73 20 2d 3e 20 44 30 | 0d 20 20 20 20 4d 55 4c |es -> D0|. MUL|
|000051e0| 55 2e 57 20 20 20 20 20 | 23 34 2c 44 30 20 20 20 |U.W |#4,D0 |
|000051f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005200| 20 3b 73 69 7a 65 20 6f | 66 20 6f 6c 64 20 74 61 | ;size o|f old ta|
|00005210| 62 6c 65 20 2d 3e 20 44 | 30 0d 20 20 20 20 5f 42 |ble -> D|0. _B|
|00005220| 6c 6f 63 6b 4d 6f 76 65 | 20 20 20 20 20 20 20 20 |lockMove| |
|00005230| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005240| 20 20 3b 63 6f 70 79 20 | 6f 6c 64 20 74 61 62 6c | ;copy |old tabl|
|00005250| 65 20 74 6f 20 6e 65 77 | 20 74 61 62 6c 65 0d 20 |e to new| table. |
|00005260| 20 20 20 5f 44 69 73 70 | 6f 73 50 74 72 20 20 20 | _Disp|osPtr |
|00005270| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005280| 20 20 20 20 20 20 20 3b | 67 65 74 20 72 69 64 20 | ;|get rid |
|00005290| 6f 66 20 6f 6c 64 20 74 | 61 62 6c 65 0d 20 20 20 |of old t|able. |
|000052a0| 20 4d 4f 56 45 2e 4c 20 | 20 20 20 20 41 31 2c 55 | MOVE.L | A1,U|
|000052b0| 54 61 62 6c 65 42 61 73 | 65 20 20 20 20 20 20 20 |TableBas|e |
|000052c0| 20 20 20 20 20 3b 6d 61 | 6b 65 20 75 73 20 6e 65 | ;ma|ke us ne|
|000052d0| 77 20 75 6e 69 74 20 74 | 61 62 6c 65 0d 20 20 20 |w unit t|able. |
|000052e0| 20 4d 4f 56 45 2e 57 20 | 20 20 20 20 44 31 2c 55 | MOVE.W | D1,U|
|000052f0| 6e 69 74 4e 74 72 79 43 | 6e 74 20 20 20 20 20 20 |nitNtryC|nt |
|00005300| 20 20 20 20 20 3b 75 70 | 64 61 74 65 20 6e 75 6d | ;up|date num|
|00005310| 62 65 72 20 6f 66 20 65 | 6e 74 72 69 65 73 0d 20 |ber of e|ntries. |
|00005320| 20 20 20 4d 4f 56 45 20 | 20 20 20 20 20 20 28 53 | MOVE | (S|
|00005330| 50 29 2b 2c 53 52 20 20 | 20 20 20 20 20 20 20 20 |P)+,SR | |
|00005340| 20 20 20 20 20 20 20 3b | 72 65 73 74 6f 72 65 20 | ;|restore |
|00005350| 6f 6c 64 20 69 6e 74 65 | 72 72 75 70 74 20 73 74 |old inte|rrupt st|
|00005360| 61 74 75 73 0d 44 54 53 | 20 73 75 67 67 65 73 74 |atus.DTS| suggest|
|00005370| 73 20 74 68 61 74 20 69 | 66 20 55 6e 69 74 4e 74 |s that i|f UnitNt|
|00005380| 72 79 43 6e 74 20 77 61 | 73 20 6f 72 69 67 69 6e |ryCnt wa|s origin|
|00005390| 61 6c 6c 79 20 34 38 2c | 20 79 6f 75 20 69 6e 63 |ally 48,| you inc|
|000053a0| 72 65 61 73 65 20 69 74 | 20 74 6f 20 36 34 2c 20 |rease it| to 64, |
|000053b0| 61 64 6a 75 73 74 69 6e | 67 20 74 68 65 20 74 61 |adjustin|g the ta|
|000053c0| 62 6c 65 20 73 69 7a 65 | 20 61 73 20 73 68 6f 77 |ble size| as show|
|000053d0| 6e 2e 0d 41 74 20 74 68 | 69 73 20 70 6f 69 6e 74 |n..At th|is point|
|000053e0| 2c 20 77 69 74 68 20 74 | 68 65 20 75 6e 69 74 20 |, with t|he unit |
|000053f0| 74 61 62 6c 65 20 72 65 | 73 69 7a 65 64 20 6f 72 |table re|sized or|
|00005400| 20 61 6c 72 65 61 64 79 | 20 61 74 20 61 20 73 69 | already| at a si|
|00005410| 7a 65 20 74 6f 20 68 6f | 6c 64 20 6d 6f 72 65 20 |ze to ho|ld more |
|00005420| 74 68 61 6e 20 34 38 20 | 75 6e 69 74 20 6e 75 6d |than 48 |unit num|
|00005430| 62 65 72 73 2c 20 69 74 | 20 6d 61 79 20 62 65 20 |bers, it| may be |
|00005440| 73 65 61 72 63 68 65 64 | 20 66 6f 72 20 61 6e 20 |searched| for an |
|00005450| 65 6d 70 74 79 20 73 6c | 6f 74 2c 20 73 74 61 72 |empty sl|ot, star|
|00005460| 74 69 6e 67 20 61 74 20 | 75 6e 69 74 20 6e 75 6d |ting at |unit num|
|00005470| 62 65 72 20 34 38 20 61 | 6e 64 20 65 6e 64 69 6e |ber 48 a|nd endin|
|00005480| 67 20 61 74 20 55 6e 69 | 74 4e 74 72 79 43 6e 74 |g at Uni|tNtryCnt|
|00005490| 2e 20 49 66 2c 20 69 6e | 20 74 68 65 20 63 61 73 |. If, in| the cas|
|000054a0| 65 20 77 68 65 72 65 20 | 74 68 65 20 75 6e 69 74 |e where |the unit|
|000054b0| 20 74 61 62 6c 65 20 61 | 6c 72 65 61 64 79 20 68 | table a|lready h|
|000054c0| 65 6c 64 20 6d 6f 72 65 | 20 74 68 61 6e 20 34 38 |eld more| than 48|
|000054d0| 20 75 6e 69 74 20 6e 75 | 6d 62 65 72 73 2c 20 6e | unit nu|mbers, n|
|000054e0| 6f 20 65 6d 70 74 79 20 | 73 6c 6f 74 20 77 61 73 |o empty |slot was|
|000054f0| 20 66 6f 75 6e 64 2c 20 | 74 68 65 6e 20 74 68 65 | found, |then the|
|00005500| 20 75 6e 69 74 20 74 61 | 62 6c 65 20 6d 69 67 68 | unit ta|ble migh|
|00005510| 74 20 62 65 20 61 62 6c | 65 20 74 6f 20 62 65 20 |t be abl|e to be |
|00005520| 65 78 70 61 6e 64 65 64 | 20 61 73 20 77 61 73 20 |expanded| as was |
|00005530| 64 65 73 63 72 69 62 65 | 64 20 70 72 65 76 69 6f |describe|d previo|
|00005540| 75 73 6c 79 2e 20 54 68 | 69 73 20 74 69 6d 65 2c |usly. Th|is time,|
|00005550| 20 68 6f 77 65 76 65 72 | 2c 20 74 68 65 20 70 72 | however|, the pr|
|00005560| 6f 63 65 73 73 20 63 61 | 6e 20 62 65 20 61 20 62 |ocess ca|n be a b|
|00005570| 69 74 20 6d 6f 72 65 20 | 63 6f 6d 70 6c 69 63 61 |it more |complica|
|00005580| 74 65 64 2e 0d 49 74 20 | 63 6f 75 6c 64 20 76 65 |ted..It |could ve|
|00005590| 72 79 20 77 65 6c 6c 20 | 62 65 20 74 68 61 74 20 |ry well |be that |
|000055a0| 74 68 65 20 75 6e 69 74 | 20 74 61 62 6c 65 20 69 |the unit| table i|
|000055b0| 74 73 65 6c 66 20 69 73 | 20 61 6c 72 65 61 64 79 |tself is| already|
|000055c0| 20 6c 61 72 67 65 72 20 | 74 68 61 6e 20 77 68 61 | larger |than wha|
|000055d0| 74 20 55 6e 69 74 4e 74 | 72 79 43 6e 74 20 77 6f |t UnitNt|ryCnt wo|
|000055e0| 75 6c 64 20 69 6e 64 69 | 63 61 74 65 2c 20 65 69 |uld indi|cate, ei|
|000055f0| 74 68 65 72 20 62 65 63 | 61 75 73 65 20 74 68 65 |ther bec|ause the|
|00005600| 20 6d 61 63 68 69 6e 65 | 20 69 73 20 61 20 4d 61 | machine| is a Ma|
|00005610| 63 69 6e 74 6f 73 68 20 | 49 49 d0 63 6c 61 73 73 |cintosh |II.class|
|00005620| 20 6d 61 63 68 69 6e 65 | 20 6f 72 20 73 6f 6d 65 | machine| or some|
|00005630| 62 6f 64 79 20 65 6c 73 | 65 20 68 61 73 20 63 68 |body els|e has ch|
|00005640| 61 6e 67 65 64 20 74 68 | 69 6e 67 73 20 61 68 65 |anged th|ings ahe|
|00005650| 61 64 20 6f 66 20 79 6f | 75 72 20 49 4e 49 54 2e |ad of yo|ur INIT.|
|00005660| 20 54 68 65 20 62 65 73 | 74 20 61 63 74 69 6f 6e | The bes|t action|
|00005670| 20 74 6f 20 74 61 6b 65 | 20 77 6f 75 6c 64 20 62 | to take| would b|
|00005680| 65 20 74 6f 20 63 61 6c | 6c 20 5f 47 65 74 50 74 |e to cal|l _GetPt|
|00005690| 72 53 69 7a 65 20 6f 6e | 20 74 68 65 20 75 6e 69 |rSize on| the uni|
|000056a0| 74 20 74 61 62 6c 65 2c | 20 64 69 76 69 64 65 20 |t table,| divide |
|000056b0| 74 68 65 20 72 65 73 75 | 6c 74 20 62 79 20 66 6f |the resu|lt by fo|
|000056c0| 75 72 2c 20 72 6f 75 6e | 64 69 6e 67 20 64 6f 77 |ur, roun|ding dow|
|000056d0| 6e 2c 20 61 6e 64 20 63 | 6f 6d 70 61 72 65 20 74 |n, and c|ompare t|
|000056e0| 68 61 74 20 6e 75 6d 62 | 65 72 20 74 6f 20 55 6e |hat numb|er to Un|
|000056f0| 69 74 4e 74 72 79 43 6e | 74 2e 20 49 66 20 55 6e |itNtryCn|t. If Un|
|00005700| 69 74 4e 74 72 79 43 6e | 74 20 69 73 20 6c 6f 77 |itNtryCn|t is low|
|00005710| 65 72 20 74 68 61 6e 20 | 74 68 61 74 20 72 65 73 |er than |that res|
|00005720| 75 6c 74 2c 20 79 6f 75 | 20 63 61 6e 20 69 6e 63 |ult, you| can inc|
|00005730| 72 65 6d 65 6e 74 20 55 | 6e 69 74 4e 74 72 79 43 |rement U|nitNtryC|
|00005740| 6e 74 20 62 79 20 61 6e | 79 20 61 6d 6f 75 6e 74 |nt by an|y amount|
|00005750| 20 74 68 61 74 20 6b 65 | 65 70 73 20 69 74 20 6c | that ke|eps it l|
|00005760| 65 73 73 20 74 68 61 6e | 20 6f 72 20 65 71 75 61 |ess than| or equa|
|00005770| 6c 20 74 6f 20 74 68 65 | 20 6d 61 78 69 6d 75 6d |l to the| maximum|
|00005780| 20 61 6c 6c 6f 77 61 62 | 6c 65 20 73 69 7a 65 20 | allowab|le size |
|00005790| 74 68 61 74 20 74 68 65 | 20 75 6e 69 74 20 74 61 |that the| unit ta|
|000057a0| 62 6c 65 20 63 61 6e 20 | 68 61 6e 64 6c 65 2e 20 |ble can |handle. |
|000057b0| 46 6f 75 72 20 69 73 20 | 61 20 67 6f 6f 64 20 6e |Four is |a good n|
|000057c0| 75 6d 62 65 72 2c 20 62 | 65 63 61 75 73 65 20 69 |umber, b|ecause i|
|000057d0| 74 20 72 65 64 75 63 65 | 73 20 74 68 65 20 6e 65 |t reduce|s the ne|
|000057e0| 65 64 20 66 6f 72 20 73 | 6f 6d 65 6f 6e 65 20 65 |ed for s|omeone e|
|000057f0| 6c 73 65 20 74 6f 20 64 | 6f 20 74 68 65 20 73 61 |lse to d|o the sa|
|00005800| 6d 65 20 63 68 65 63 6b | 20 6c 61 74 65 72 20 6f |me check| later o|
|00005810| 6e 20 77 69 74 68 6f 75 | 74 20 61 6c 73 6f 20 6d |n withou|t also m|
|00005820| 61 6b 69 6e 67 20 74 68 | 65 20 73 65 61 72 63 68 |aking th|e search|
|00005830| 20 66 6f 72 20 61 20 67 | 69 76 65 6e 20 64 72 69 | for a g|iven dri|
|00005840| 76 65 72 2e 20 4f 6e 63 | 65 20 55 6e 69 74 4e 74 |ver. Onc|e UnitNt|
|00005850| 72 79 43 6e 74 20 68 61 | 73 20 62 65 65 6e 20 69 |ryCnt ha|s been i|
|00005860| 6e 63 72 65 6d 65 6e 74 | 65 64 2c 20 79 6f 75 20 |ncrement|ed, you |
|00005870| 6b 6e 6f 77 20 79 6f 75 | 20 68 61 76 65 20 61 6e |know you| have an|
|00005880| 20 65 6d 70 74 79 20 73 | 6c 6f 74 20 77 61 69 74 | empty s|lot wait|
|00005890| 69 6e 67 2e 0d 49 66 20 | 55 6e 69 74 4e 74 72 79 |ing..If |UnitNtry|
|000058a0| 43 6e 74 20 69 73 20 61 | 6c 72 65 61 64 79 20 65 |Cnt is a|lready e|
|000058b0| 71 75 61 6c 20 74 6f 20 | 74 68 65 20 73 69 7a 65 |qual to |the size|
|000058c0| 20 6f 66 20 74 68 65 20 | 75 6e 69 74 20 74 61 62 | of the |unit tab|
|000058d0| 6c 65 20 64 69 76 69 64 | 65 64 20 62 79 20 66 6f |le divid|ed by fo|
|000058e0| 75 72 2c 20 79 6f 75 20 | 73 68 6f 75 6c 64 20 65 |ur, you |should e|
|000058f0| 78 70 61 6e 64 20 74 68 | 65 20 75 6e 69 74 20 74 |xpand th|e unit t|
|00005900| 61 62 6c 65 20 61 73 20 | 64 65 73 63 72 69 62 65 |able as |describe|
|00005910| 64 20 70 72 65 76 69 6f | 75 73 6c 79 2c 20 63 68 |d previo|usly, ch|
|00005920| 6f 6f 73 69 6e 67 20 61 | 20 73 69 7a 65 20 61 72 |oosing a| size ar|
|00005930| 6f 75 6e 64 20 31 36 20 | 6f 72 20 33 32 20 62 79 |ound 16 |or 32 by|
|00005940| 74 65 73 20 67 72 65 61 | 74 65 72 20 74 68 61 6e |tes grea|ter than|
|00005950| 20 74 68 65 20 6f 6c 64 | 20 73 69 7a 65 2e 20 52 | the old| size. R|
|00005960| 65 6d 65 6d 62 65 72 20 | 61 6c 77 61 79 73 20 74 |emember |always t|
|00005970| 6f 20 63 68 65 63 6b 20 | 74 68 65 20 72 65 73 75 |o check |the resu|
|00005980| 6c 74 20 6f 66 20 74 68 | 65 20 5f 4e 65 77 50 74 |lt of th|e _NewPt|
|00005990| 72 20 63 61 6c 6c 3b 20 | 69 74 20 77 6f 75 6c 64 |r call; |it would|
|000059a0| 20 62 65 20 63 61 74 61 | 73 74 72 6f 70 68 69 63 | be cata|strophic|
|000059b0| 20 74 6f 20 63 6f 70 79 | 20 74 68 65 20 6f 6c 64 | to copy| the old|
|000059c0| 20 75 6e 69 74 20 74 61 | 62 6c 65 20 69 6e 74 6f | unit ta|ble into|
|000059d0| 20 74 68 65 20 6c 6f 77 | 2d 6d 65 6d 6f 72 79 20 | the low|-memory |
|000059e0| 67 6c 6f 62 61 6c 20 61 | 72 65 61 2e 0d 4f 6e 63 |global a|rea..Onc|
|000059f0| 65 20 79 6f 75 20 68 61 | 76 65 20 66 6f 75 6e 64 |e you ha|ve found|
|00005a00| 20 61 20 73 6c 6f 74 20 | 66 6f 72 20 74 68 65 20 | a slot |for the |
|00005a10| 64 72 69 76 65 72 20 69 | 6e 20 74 68 65 20 75 6e |driver i|n the un|
|00005a20| 69 74 20 74 61 62 6c 65 | 2c 20 63 61 6c 6c 20 5f |it table|, call _|
|00005a30| 44 72 69 76 65 72 49 6e | 73 74 61 6c 6c 20 77 69 |DriverIn|stall wi|
|00005a40| 74 68 20 74 68 65 20 63 | 6f 72 72 65 73 70 6f 6e |th the c|orrespon|
|00005a50| 64 69 6e 67 20 72 65 66 | 6e 75 6d 20 61 6e 64 20 |ding ref|num and |
|00005a60| 70 6f 69 6e 74 65 72 20 | 74 6f 20 74 68 65 20 64 |pointer |to the d|
|00005a70| 72 69 76 65 72 2e 20 54 | 68 69 73 20 63 61 6c 6c |river. T|his call|
|00005a80| 20 63 72 65 61 74 65 73 | 20 61 20 44 43 45 20 66 | creates| a DCE f|
|00005a90| 6f 72 20 74 68 65 20 64 | 72 69 76 65 72 20 61 6e |or the d|river an|
|00005aa0| 64 20 73 65 74 73 20 75 | 70 20 74 68 65 20 63 6f |d sets u|p the co|
|00005ab0| 72 72 65 63 74 20 72 65 | 66 6e 75 6d 20 69 6e 20 |rrect re|fnum in |
|00005ac0| 74 68 65 20 44 43 45 2e | 20 4e 65 78 74 2c 20 6d |the DCE.| Next, m|
|00005ad0| 6f 76 65 20 74 68 65 20 | 68 61 6e 64 6c 65 20 74 |ove the |handle t|
|00005ae0| 6f 20 74 68 65 20 64 72 | 69 76 65 72 20 69 6e 74 |o the dr|iver int|
|00005af0| 6f 20 74 68 65 20 64 43 | 74 6c 44 72 69 76 65 72 |o the dC|tlDriver|
|00005b00| 20 66 69 65 6c 64 20 6f | 66 20 74 68 65 20 44 43 | field o|f the DC|
|00005b10| 45 2c 20 74 68 65 6e 20 | 6d 6f 76 65 20 74 68 65 |E, then |move the|
|00005b20| 20 44 72 76 72 46 6c 61 | 67 73 2c 20 44 72 76 72 | DrvrFla|gs, Drvr|
|00005b30| 44 65 6c 61 79 2c 20 44 | 72 76 72 45 4d 61 73 6b |Delay, D|rvrEMask|
|00005b40| 2c 20 61 6e 64 20 44 72 | 76 72 4d 65 6e 75 20 66 |, and Dr|vrMenu f|
|00005b50| 69 65 6c 64 73 20 6f 66 | 20 74 68 65 20 64 72 69 |ields of| the dri|
|00005b60| 76 65 72 20 68 65 61 64 | 65 72 20 69 6e 74 6f 20 |ver head|er into |
|00005b70| 74 68 65 20 64 43 74 6c | 46 6c 61 67 73 2c 20 64 |the dCtl|Flags, d|
|00005b80| 43 74 6c 44 65 6c 61 79 | 2c 20 64 43 74 6c 45 4d |CtlDelay|, dCtlEM|
|00005b90| 61 73 6b 2c 20 61 6e 64 | 20 64 43 74 6c 4d 65 6e |ask, and| dCtlMen|
|00005ba0| 75 20 66 69 65 6c 64 73 | 20 6f 66 20 74 68 65 20 |u fields| of the |
|00005bb0| 44 43 45 2e 20 46 69 6e | 61 6c 6c 79 2c 20 73 65 |DCE. Fin|ally, se|
|00005bc0| 74 20 74 68 65 20 64 52 | 61 6d 42 61 73 65 64 20 |t the dR|amBased |
|00005bd0| 62 69 74 20 69 6e 20 74 | 68 65 20 64 43 74 6c 46 |bit in t|he dCtlF|
|00005be0| 6c 61 67 73 20 66 69 65 | 6c 64 20 6f 66 20 74 68 |lags fie|ld of th|
|00005bf0| 65 20 44 43 45 2e 20 54 | 68 61 74 d5 73 20 61 6c |e DCE. T|hat.s al|
|00005c00| 6c 20 74 68 65 72 65 20 | 69 73 20 74 6f 20 69 74 |l there |is to it|
|00005c10| 2e 0d 49 6d 6d 65 64 69 | 61 74 65 20 41 73 79 6e |..Immedi|ate Asyn|
|00005c20| 63 68 72 6f 6e 69 63 69 | 74 79 0d 54 68 65 20 5f |chronici|ty.The _|
|00005c30| 52 65 61 64 2c 20 5f 57 | 72 69 74 65 2c 20 5f 53 |Read, _W|rite, _S|
|00005c40| 74 61 74 75 73 2c 20 61 | 6e 64 20 5f 43 6f 6e 74 |tatus, a|nd _Cont|
|00005c50| 72 6f 6c 20 74 72 61 70 | 73 20 64 69 66 66 65 72 |rol trap|s differ|
|00005c60| 20 66 72 6f 6d 20 5f 4f | 70 65 6e 2c 20 5f 43 6c | from _O|pen, _Cl|
|00005c70| 6f 73 65 2c 20 61 6e 64 | 20 5f 4b 69 6c 6c 49 4f |ose, and| _KillIO|
|00005c80| 20 69 6e 20 74 68 61 74 | 20 61 20 72 65 71 75 65 | in that| a reque|
|00005c90| 73 74 20 63 61 6e 20 62 | 65 20 d2 71 75 65 75 65 |st can b|e .queue|
|00005ca0| 64 2c d3 20 28 74 68 61 | 74 20 69 73 2c 20 69 6e |d,. (tha|t is, in|
|00005cb0| 73 65 72 74 65 64 20 69 | 6e 74 6f 20 61 20 77 61 |serted i|nto a wa|
|00005cc0| 69 74 69 6e 67 20 6c 69 | 73 74 20 6f 66 20 72 65 |iting li|st of re|
|00005cd0| 71 75 65 73 74 73 20 66 | 6f 72 20 74 68 61 74 20 |quests f|or that |
|00005ce0| 64 65 76 69 63 65 20 64 | 72 69 76 65 72 29 2e 20 |device d|river). |
|00005cf0| 54 68 69 73 20 71 75 65 | 75 65 20 61 6c 6c 6f 77 |This que|ue allow|
|00005d00| 73 20 72 65 71 75 65 73 | 74 73 20 74 6f 20 62 65 |s reques|ts to be|
|00005d10| 20 73 61 76 65 64 20 66 | 6f 72 20 70 72 6f 63 65 | saved f|or proce|
|00005d20| 73 73 69 6e 67 20 6c 61 | 74 65 72 20 69 66 20 74 |ssing la|ter if t|
|00005d30| 68 65 20 64 72 69 76 65 | 72 20 69 73 20 62 75 73 |he drive|r is bus|
|00005d40| 79 20 68 61 6e 64 6c 69 | 6e 67 20 61 6e 6f 74 68 |y handli|ng anoth|
|00005d50| 65 72 20 72 65 71 75 65 | 73 74 2e 20 41 73 20 74 |er reque|st. As t|
|00005d60| 68 65 20 64 65 76 69 63 | 65 20 64 72 69 76 65 72 |he devic|e driver|
|00005d70| 20 66 69 6e 69 73 68 65 | 73 20 73 65 72 76 69 63 | finishe|s servic|
|00005d80| 69 6e 67 20 65 61 63 68 | 20 72 65 71 75 65 73 74 |ing each| request|
|00005d90| 2c 20 74 68 65 20 6e 65 | 78 74 20 72 65 71 75 65 |, the ne|xt reque|
|00005da0| 73 74 20 69 6e 20 6c 69 | 6e 65 20 69 73 20 70 61 |st in li|ne is pa|
|00005db0| 73 73 65 64 20 74 6f 20 | 74 68 65 20 64 72 69 76 |ssed to |the driv|
|00005dc0| 65 72 20 75 6e 74 69 6c | 20 6e 6f 20 6d 6f 72 65 |er until| no more|
|00005dd0| 20 72 65 71 75 65 73 74 | 73 20 72 65 6d 61 69 6e | request|s remain|
|00005de0| 2e 20 43 61 6c 6c 73 20 | 6d 61 64 65 20 74 6f 20 |. Calls |made to |
|00005df0| 5f 4f 70 65 6e 2c 20 5f | 43 6c 6f 73 65 2c 20 61 |_Open, _|Close, a|
|00005e00| 6e 64 20 5f 4b 69 6c 6c | 49 4f 2c 20 68 6f 77 65 |nd _Kill|IO, howe|
|00005e10| 76 65 72 2c 20 6d 75 73 | 74 20 62 65 20 68 61 6e |ver, mus|t be han|
|00005e20| 64 6c 65 64 20 69 6d 6d | 65 64 69 61 74 65 6c 79 |dled imm|ediately|
|00005e30| 2c 20 73 6f 20 74 68 65 | 79 20 61 72 65 20 6e 65 |, so the|y are ne|
|00005e40| 76 65 72 20 71 75 65 75 | 65 64 2e 20 54 68 69 73 |ver queu|ed. This|
|00005e50| 20 62 65 68 61 76 69 6f | 72 20 69 73 20 6e 6f 74 | behavio|r is not|
|00005e60| 20 61 20 70 72 6f 62 6c | 65 6d 20 77 69 74 68 20 | a probl|em with |
|00005e70| 4f 70 65 6e 20 72 65 71 | 75 65 73 74 73 2c 20 73 |Open req|uests, s|
|00005e80| 69 6e 63 65 20 74 68 65 | 72 65 20 61 72 65 20 75 |ince the|re are u|
|00005e90| 73 75 61 6c 6c 79 20 6e | 6f 20 72 65 71 75 65 73 |sually n|o reques|
|00005ea0| 74 73 20 61 6c 72 65 61 | 64 79 20 71 75 65 75 65 |ts alrea|dy queue|
|00005eb0| 64 2e 20 57 68 61 74 20 | 68 61 70 70 65 6e 73 20 |d. What |happens |
|00005ec0| 77 69 74 68 20 43 6c 6f | 73 65 20 72 65 71 75 65 |with Clo|se reque|
|00005ed0| 73 74 73 20 69 73 20 64 | 65 73 63 72 69 62 65 64 |sts is d|escribed|
|00005ee0| 20 6c 61 74 65 72 20 69 | 6e 20 74 68 69 73 20 4e | later i|n this N|
|00005ef0| 6f 74 65 2e 0d 41 73 20 | 6e 6f 74 65 64 20 65 61 |ote..As |noted ea|
|00005f00| 72 6c 69 65 72 2c 20 74 | 68 65 73 65 20 74 72 61 |rlier, t|hese tra|
|00005f10| 70 73 20 63 61 6e 20 62 | 65 20 6f 70 74 69 6f 6e |ps can b|e option|
|00005f20| 61 6c 6c 79 20 65 78 65 | 63 75 74 65 64 20 69 6d |ally exe|cuted im|
|00005f30| 6d 65 64 69 61 74 65 6c | 79 2c 20 61 73 79 6e 63 |mediatel|y, async|
|00005f40| 68 72 6f 6e 6f 75 73 6c | 79 2c 20 6f 72 20 62 6f |hronousl|y, or bo|
|00005f50| 74 68 2e 20 4e 6f 72 6d | 61 6c 6c 79 2c 20 77 68 |th. Norm|ally, wh|
|00005f60| 65 6e 20 61 20 74 72 61 | 70 20 69 73 20 65 78 65 |en a tra|p is exe|
|00005f70| 63 75 74 65 64 2c 20 69 | 74 20 6d 65 61 6e 73 20 |cuted, i|t means |
|00005f80| 74 68 61 74 20 63 6f 6e | 74 72 6f 6c 20 73 68 6f |that con|trol sho|
|00005f90| 75 6c 64 20 6e 6f 74 20 | 72 65 74 75 72 6e 20 74 |uld not |return t|
|00005fa0| 6f 20 74 68 65 20 63 61 | 6c 6c 65 72 20 75 6e 74 |o the ca|ller unt|
|00005fb0| 69 6c 20 74 68 65 20 72 | 65 71 75 65 73 74 20 68 |il the r|equest h|
|00005fc0| 61 73 20 62 65 65 6e 20 | 63 6f 6d 70 6c 65 74 65 |as been |complete|
|00005fd0| 64 2e 20 54 68 61 74 20 | 69 73 2c 20 74 68 65 20 |d. That |is, the |
|00005fe0| 72 65 71 75 65 73 74 65 | 64 20 74 61 73 6b 20 63 |requeste|d task c|
|00005ff0| 6f 6d 70 6c 65 74 65 6c | 79 20 66 69 6e 69 73 68 |ompletel|y finish|
|00006000| 65 73 20 64 6f 69 6e 67 | 20 77 68 61 74 65 76 65 |es doing| whateve|
|00006010| 72 20 77 61 73 20 61 73 | 6b 65 64 20 61 6e 64 20 |r was as|ked and |
|00006020| 6e 65 65 64 73 20 74 6f | 20 64 6f 20 6e 6f 20 66 |needs to| do no f|
|00006030| 75 72 74 68 65 72 20 61 | 63 74 69 6f 6e 2e 20 46 |urther a|ction. F|
|00006040| 6f 72 20 65 78 61 6d 70 | 6c 65 2c 20 61 73 73 75 |or examp|le, assu|
|00006050| 6d 65 20 61 20 5f 52 65 | 61 64 20 74 72 61 70 20 |me a _Re|ad trap |
|00006060| 69 73 20 63 61 6c 6c 65 | 64 20 66 6f 72 20 61 20 |is calle|d for a |
|00006070| 73 65 72 69 61 6c 20 64 | 72 69 76 65 72 2e 20 49 |serial d|river. I|
|00006080| 66 20 63 61 6c 6c 65 64 | 20 6e 6f 72 6d 61 6c 6c |f called| normall|
|00006090| 79 2c 20 63 6f 6e 74 72 | 6f 6c 20 77 6f 75 6c 64 |y, contr|ol would|
|000060a0| 20 6e 6f 74 20 72 65 74 | 75 72 6e 20 74 6f 20 74 | not ret|urn to t|
|000060b0| 68 65 20 63 61 6c 6c 65 | 72 20 75 6e 74 69 6c 20 |he calle|r until |
|000060c0| 61 20 63 68 61 72 61 63 | 74 65 72 20 77 61 73 20 |a charac|ter was |
|000060d0| 72 65 63 65 69 76 65 64 | 2e 0d 41 6e 20 61 73 79 |received|..An asy|
|000060e0| 6e 63 68 72 6f 6e 6f 75 | 73 6c 79 20 65 78 65 63 |nchronou|sly exec|
|000060f0| 75 74 65 64 20 74 72 61 | 70 20 73 68 6f 75 6c 64 |uted tra|p should|
|00006100| 20 72 65 74 75 72 6e 20 | 74 6f 20 74 68 65 20 63 | return |to the c|
|00006110| 61 6c 6c 65 72 20 61 73 | 20 73 6f 6f 6e 20 61 73 |aller as| soon as|
|00006120| 20 70 6f 73 73 69 62 6c | 65 2c 20 65 76 65 6e 20 | possibl|e, even |
|00006130| 69 66 20 74 68 65 20 72 | 65 71 75 65 73 74 20 63 |if the r|equest c|
|00006140| 61 6e 6e 6f 74 20 62 65 | 20 63 6f 6d 70 6c 65 74 |annot be| complet|
|00006150| 65 64 20 62 65 66 6f 72 | 65 20 72 65 74 75 72 6e |ed befor|e return|
|00006160| 69 6e 67 2e 20 49 6e 20 | 74 68 65 20 70 72 65 76 |ing. In |the prev|
|00006170| 69 6f 75 73 20 65 78 61 | 6d 70 6c 65 2c 20 69 66 |ious exa|mple, if|
|00006180| 20 5f 52 65 61 64 20 77 | 65 72 65 20 65 78 65 63 | _Read w|ere exec|
|00006190| 75 74 65 64 20 61 73 79 | 6e 63 68 72 6f 6e 6f 75 |uted asy|nchronou|
|000061a0| 73 6c 79 2c 20 69 74 20 | 77 6f 75 6c 64 20 72 65 |sly, it |would re|
|000061b0| 74 75 72 6e 20 63 6f 6e | 74 72 6f 6c 20 61 73 20 |turn con|trol as |
|000061c0| 73 6f 6f 6e 20 61 73 20 | 74 68 65 20 72 65 71 75 |soon as |the requ|
|000061d0| 65 73 74 20 77 61 73 20 | 6e 6f 74 65 64 20 72 61 |est was |noted ra|
|000061e0| 74 68 65 72 20 74 68 61 | 6e 20 77 61 69 74 69 6e |ther tha|n waitin|
|000061f0| 67 20 75 6e 74 69 6c 20 | 61 20 63 68 61 72 61 63 |g until |a charac|
|00006200| 74 65 72 20 77 61 73 20 | 72 65 63 65 69 76 65 64 |ter was |received|
|00006210| 2e 20 57 68 65 6e 20 61 | 20 63 68 61 72 61 63 74 |. When a| charact|
|00006220| 65 72 20 66 69 6e 61 6c | 6c 79 20 77 61 73 20 72 |er final|ly was r|
|00006230| 65 63 65 69 76 65 64 2c | 20 74 68 65 20 69 6f 52 |eceived,| the ioR|
|00006240| 65 73 75 6c 74 20 6f 66 | 20 74 68 65 20 70 61 72 |esult of| the par|
|00006250| 61 6d 65 74 65 72 20 62 | 6c 6f 63 6b 20 77 6f 75 |ameter b|lock wou|
|00006260| 6c 64 20 72 65 66 6c 65 | 63 74 20 74 68 61 74 20 |ld refle|ct that |
|00006270| 66 61 63 74 2c 20 61 6e | 64 20 61 6e 79 20 69 6f |fact, an|d any io|
|00006280| 43 6f 6d 70 6c 65 74 69 | 6f 6e 20 72 6f 75 74 69 |Completi|on routi|
|00006290| 6e 65 20 77 6f 75 6c 64 | 20 62 65 20 65 78 65 63 |ne would| be exec|
|000062a0| 75 74 65 64 2e 0d 57 68 | 65 6e 20 61 20 74 72 61 |uted..Wh|en a tra|
|000062b0| 70 20 69 73 20 65 78 65 | 63 75 74 65 64 20 69 6d |p is exe|cuted im|
|000062c0| 6d 65 64 69 61 74 65 6c | 79 2c 20 69 74 20 6d 65 |mediatel|y, it me|
|000062d0| 61 6e 73 20 74 68 61 74 | 20 74 68 65 20 72 65 71 |ans that| the req|
|000062e0| 75 65 73 74 20 69 73 20 | 6e 6f 74 20 71 75 65 75 |uest is |not queu|
|000062f0| 65 64 2c 20 62 75 74 20 | 72 61 74 68 65 72 20 73 |ed, but |rather s|
|00006300| 65 6e 74 20 69 6d 6d 65 | 64 69 61 74 65 6c 79 20 |ent imme|diately |
|00006310| 74 6f 20 74 68 65 20 64 | 72 69 76 65 72 2c 20 77 |to the d|river, w|
|00006320| 68 65 74 68 65 72 20 6f | 72 20 6e 6f 74 20 69 74 |hether o|r not it|
|00006330| 20 69 73 20 62 75 73 79 | 20 68 61 6e 64 6c 69 6e | is busy| handlin|
|00006340| 67 20 61 6e 6f 74 68 65 | 72 20 72 65 71 75 65 73 |g anothe|r reques|
|00006350| 74 2e 20 49 6d 6d 65 64 | 69 61 74 65 20 72 65 71 |t. Immed|iate req|
|00006360| 75 65 73 74 73 20 61 72 | 65 20 74 79 70 69 63 61 |uests ar|e typica|
|00006370| 6c 6c 79 20 6e 6f 74 20 | 49 2f 4f 2d 72 65 6c 61 |lly not |I/O-rela|
|00006380| 74 65 64 20 69 6e 20 6e | 61 74 75 72 65 2e 20 49 |ted in n|ature. I|
|00006390| 66 20 74 68 65 20 65 78 | 61 6d 70 6c 65 20 63 61 |f the ex|ample ca|
|000063a0| 6c 6c 20 77 65 72 65 20 | 74 6f 20 68 61 76 65 20 |ll were |to have |
|000063b0| 62 65 65 6e 20 65 78 65 | 63 75 74 65 64 20 69 6d |been exe|cuted im|
|000063c0| 6d 65 64 69 61 74 65 6c | 79 2c 20 69 74 20 69 73 |mediatel|y, it is|
|000063d0| 20 6e 6f 74 20 63 6c 65 | 61 72 20 77 68 61 74 20 | not cle|ar what |
|000063e0| 74 68 65 20 70 72 6f 70 | 65 72 20 72 65 73 70 6f |the prop|er respo|
|000063f0| 6e 73 65 20 6f 66 20 74 | 68 65 20 64 72 69 76 65 |nse of t|he drive|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.